]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
IPoIB: Fix oops with raw sockets
authorRoland Dreier <rolandd@cisco.com>
Wed, 29 Mar 2006 17:36:46 +0000 (09:36 -0800)
committerRoland Dreier <rolandd@cisco.com>
Wed, 29 Mar 2006 17:36:46 +0000 (09:36 -0800)
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>
drivers/infiniband/ulp/ipoib/ipoib_main.c

index 53a32f65788d2e2e3b5cd19abdb4d2bf924475fd..9b0bd7c746ca1c8623c3d921f4135ba89a3b378c 100644 (file)
@@ -723,7 +723,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
         * destination address onto the front of the skb so we can
         * 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 *) skb_push(skb, sizeof *phdr);
                memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN);