Backported some 2.6.32 IB bug fixes to the 2.6.30 kernel.
[mirror/scst/.git] / srpt / patches / kernel-2.6.30-721d67cdca5b7642b380ca0584de8dceecf6102f-drop-priv-lock-before-calling-ipoib_send.patch
1 This is a backported version of a 2.6.32 patch with the following description:
2  
3 commit 721d67cdca5b7642b380ca0584de8dceecf6102f
4 Author: Roland Dreier <rolandd@cisco.com>
5 Date:   Sat Sep 5 20:23:40 2009 -0700
6
7     IPoIB: Drop priv->lock before calling ipoib_send()
8
9     IPoIB currently must use irqsave locking for priv->lock, since it is
10     taken from interrupt context in one path.  However, ipoib_send() does
11     skb_orphan(), and the network stack locking is not IRQ-safe.
12     Therefore we need to make sure we don't hold priv->lock when calling
13     ipoib_send() to avoid lockdep warnings (the code was almost certainly
14     safe in practice, since the only code path that takes priv->lock from
15     interrupt context would never call into the network stack).
16
17     Addresses: http://bugzilla.kernel.org/show_bug.cgi?id=13757
18     Reported-by: Bart Van Assche <bart.vanassche@gmail.com>
19     Signed-off-by: Roland Dreier <rolandd@cisco.com>
20
21 ---
22
23 diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
24 index e319d91..2bf5116 100644
25 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
26 +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
27 @@ -604,8 +604,11 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
28                                            skb_queue_len(&neigh->queue));
29                                 goto err_drop;
30                         }
31 -               } else
32 +               } else {
33 +                       spin_unlock_irqrestore(&priv->lock, flags);
34                         ipoib_send(dev, skb, path->ah, IPOIB_QPN(skb->dst->neighbour->ha));
35 +                       return;
36 +               }
37         } else {
38                 neigh->ah  = NULL;
39  
40 @@ -688,7 +691,9 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev,
41                 ipoib_dbg(priv, "Send unicast ARP to %04x\n",
42                           be16_to_cpu(path->pathrec.dlid));
43  
44 +               spin_unlock_irqrestore(&priv->lock, flags);
45                 ipoib_send(dev, skb, path->ah, IPOIB_QPN(phdr->hwaddr));
46 +               return;
47         } else if ((path->query || !path_rec_start(dev, path)) &&
48                    skb_queue_len(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
49                 /* put pseudoheader back on for next time */
50 diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
51 index a0e9753..a0825fe 100644
52 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
53 +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
54 @@ -720,7 +720,9 @@ out:
55                         }
56                 }
57  
58 +               spin_unlock_irqrestore(&priv->lock, flags);
59                 ipoib_send(dev, skb, mcast->ah, IB_MULTICAST_QPN);
60 +               return;
61         }
62  
63  unlock: