Browse Source

IPoIB: Fix oops with raw sockets

ipoib_hard_header() needs to handle the case that daddr is NULL.  This
can happen when packets are injected via a raw socket, and IPoIB
shouldn't oops in this case.

Reported by Anton Blanchard <anton@samba.org>

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Roland Dreier 19 years ago
parent
commit
ef12d45619
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/infiniband/ulp/ipoib/ipoib_main.c

+ 1 - 1
drivers/infiniband/ulp/ipoib/ipoib_main.c

@@ -723,7 +723,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
 	 * destination address onto the front of the skb so we can
 	 * destination address onto the front of the skb so we can
 	 * figure out where to send the packet later.
 	 * figure out where to send the packet later.
 	 */
 	 */
-	if (!skb->dst || !skb->dst->neighbour) {
+	if ((!skb->dst || !skb->dst->neighbour) && daddr) {
 		struct ipoib_pseudoheader *phdr =
 		struct ipoib_pseudoheader *phdr =
 			(struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr);
 			(struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr);
 		memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN);
 		memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN);