From: Greg KH <gregkh@suse.de>
To: <linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Cc: <torvalds@linux-foundation.org>, <akpm@linux-foundation.org>,
<alan@lxorguk.ukuu.org.uk>, Eric Dumazet <eric.dumazet@gmail.com>,
David Miller <davem@davemloft.net>,
Roland Dreier <roland@purestorage.com>
Subject: [075/104] IB: Fix RCU lockdep splats
Date: Wed, 07 Dec 2011 08:12:17 -0800 [thread overview]
Message-ID: <20111207161220.956687641@clark.kroah.org> (raw)
In-Reply-To: <20111207161246.GA10995@kroah.com>
3.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <eric.dumazet@gmail.com>
commit 580da35a31f91a594f3090b7a2c39b85cb051a12 upstream.
Commit f2c31e32b37 ("net: fix NULL dereferences in check_peer_redir()")
forgot to take care of infiniband uses of dst neighbours.
Many thanks to Marc Aurele who provided a nice bug report and feedback.
Reported-by: Marc Aurele La France <tsi@ualberta.ca>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Roland Dreier <roland@purestorage.com>
---
drivers/infiniband/core/addr.c | 9 ++++++---
drivers/infiniband/hw/cxgb3/iwch_cm.c | 4 ++++
drivers/infiniband/hw/cxgb4/cm.c | 4 ++++
drivers/infiniband/hw/mlx4/qp.c | 2 +-
drivers/infiniband/hw/nes/nes_cm.c | 6 ++++--
drivers/infiniband/ulp/ipoib/ipoib_main.c | 18 +++++++++++-------
drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 6 ++++--
7 files changed, 34 insertions(+), 15 deletions(-)
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -215,7 +215,9 @@ static int addr4_resolve(struct sockaddr
neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, rt->dst.dev);
if (!neigh || !(neigh->nud_state & NUD_VALID)) {
+ rcu_read_lock();
neigh_event_send(dst_get_neighbour(&rt->dst), NULL);
+ rcu_read_unlock();
ret = -ENODATA;
if (neigh)
goto release;
@@ -273,15 +275,16 @@ static int addr6_resolve(struct sockaddr
goto put;
}
+ rcu_read_lock();
neigh = dst_get_neighbour(dst);
if (!neigh || !(neigh->nud_state & NUD_VALID)) {
if (neigh)
neigh_event_send(neigh, NULL);
ret = -ENODATA;
- goto put;
+ } else {
+ ret = rdma_copy_addr(addr, dst->dev, neigh->ha);
}
-
- ret = rdma_copy_addr(addr, dst->dev, neigh->ha);
+ rcu_read_unlock();
put:
dst_release(dst);
return ret;
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -1365,8 +1365,10 @@ static int pass_accept_req(struct t3cdev
goto reject;
}
dst = &rt->dst;
+ rcu_read_lock();
neigh = dst_get_neighbour(dst);
l2t = t3_l2t_get(tdev, neigh, neigh->dev);
+ rcu_read_unlock();
if (!l2t) {
printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n",
__func__);
@@ -1936,10 +1938,12 @@ int iwch_connect(struct iw_cm_id *cm_id,
}
ep->dst = &rt->dst;
+ rcu_read_lock();
neigh = dst_get_neighbour(ep->dst);
/* get a l2t entry */
ep->l2t = t3_l2t_get(ep->com.tdev, neigh, neigh->dev);
+ rcu_read_unlock();
if (!ep->l2t) {
printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__);
err = -ENOMEM;
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -1358,6 +1358,7 @@ static int pass_accept_req(struct c4iw_d
goto reject;
}
dst = &rt->dst;
+ rcu_read_lock();
neigh = dst_get_neighbour(dst);
if (neigh->dev->flags & IFF_LOOPBACK) {
pdev = ip_dev_find(&init_net, peer_ip);
@@ -1384,6 +1385,7 @@ static int pass_accept_req(struct c4iw_d
rss_qid = dev->rdev.lldi.rxq_ids[
cxgb4_port_idx(neigh->dev) * step];
}
+ rcu_read_unlock();
if (!l2t) {
printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n",
__func__);
@@ -1909,6 +1911,7 @@ int c4iw_connect(struct iw_cm_id *cm_id,
}
ep->dst = &rt->dst;
+ rcu_read_lock();
neigh = dst_get_neighbour(ep->dst);
/* get a l2t entry */
@@ -1945,6 +1948,7 @@ int c4iw_connect(struct iw_cm_id *cm_id,
ep->rss_qid = ep->com.dev->rdev.lldi.rxq_ids[
cxgb4_port_idx(neigh->dev) * step];
}
+ rcu_read_unlock();
if (!ep->l2t) {
printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__);
err = -ENOMEM;
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1309,7 +1309,7 @@ static int build_mlx_header(struct mlx4_
int is_eth;
int is_vlan = 0;
int is_grh;
- u16 vlan;
+ u16 vlan = 0;
send_size = 0;
for (i = 0; i < wr->num_sge; ++i)
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1150,9 +1150,11 @@ static int nes_addr_resolve_neigh(struct
neigh_release(neigh);
}
- if ((neigh == NULL) || (!(neigh->nud_state & NUD_VALID)))
+ if ((neigh == NULL) || (!(neigh->nud_state & NUD_VALID))) {
+ rcu_read_lock();
neigh_event_send(dst_get_neighbour(&rt->dst), NULL);
-
+ rcu_read_unlock();
+ }
ip_rt_put(rt);
return rc;
}
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -555,6 +555,7 @@ static int path_rec_start(struct net_dev
return 0;
}
+/* called with rcu_read_lock */
static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
@@ -636,6 +637,7 @@ err_drop:
spin_unlock_irqrestore(&priv->lock, flags);
}
+/* called with rcu_read_lock */
static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(skb->dev);
@@ -720,13 +722,14 @@ static int ipoib_start_xmit(struct sk_bu
struct neighbour *n = NULL;
unsigned long flags;
+ rcu_read_lock();
if (likely(skb_dst(skb)))
n = dst_get_neighbour(skb_dst(skb));
if (likely(n)) {
if (unlikely(!*to_ipoib_neigh(n))) {
ipoib_path_lookup(skb, dev);
- return NETDEV_TX_OK;
+ goto unlock;
}
neigh = *to_ipoib_neigh(n);
@@ -749,17 +752,17 @@ static int ipoib_start_xmit(struct sk_bu
ipoib_neigh_free(dev, neigh);
spin_unlock_irqrestore(&priv->lock, flags);
ipoib_path_lookup(skb, dev);
- return NETDEV_TX_OK;
+ goto unlock;
}
if (ipoib_cm_get(neigh)) {
if (ipoib_cm_up(neigh)) {
ipoib_cm_send(dev, skb, ipoib_cm_get(neigh));
- return NETDEV_TX_OK;
+ goto unlock;
}
} else if (neigh->ah) {
ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(n->ha));
- return NETDEV_TX_OK;
+ goto unlock;
}
if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
@@ -793,13 +796,14 @@ static int ipoib_start_xmit(struct sk_bu
phdr->hwaddr + 4);
dev_kfree_skb_any(skb);
++dev->stats.tx_dropped;
- return NETDEV_TX_OK;
+ goto unlock;
}
unicast_arp_send(skb, dev, phdr);
}
}
-
+unlock:
+ rcu_read_unlock();
return NETDEV_TX_OK;
}
@@ -837,7 +841,7 @@ static int ipoib_hard_header(struct sk_b
dst = skb_dst(skb);
n = NULL;
if (dst)
- n = dst_get_neighbour(dst);
+ n = dst_get_neighbour_raw(dst);
if ((!dst || !n) && daddr) {
struct ipoib_pseudoheader *phdr =
(struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr);
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -265,7 +265,7 @@ static int ipoib_mcast_join_finish(struc
skb->dev = dev;
if (dst)
- n = dst_get_neighbour(dst);
+ n = dst_get_neighbour_raw(dst);
if (!dst || !n) {
/* put pseudoheader back on for next time */
skb_push(skb, sizeof (struct ipoib_pseudoheader));
@@ -721,6 +721,8 @@ out:
if (mcast && mcast->ah) {
struct dst_entry *dst = skb_dst(skb);
struct neighbour *n = NULL;
+
+ rcu_read_lock();
if (dst)
n = dst_get_neighbour(dst);
if (n && !*to_ipoib_neigh(n)) {
@@ -733,7 +735,7 @@ out:
list_add_tail(&neigh->list, &mcast->neigh_list);
}
}
-
+ rcu_read_unlock();
spin_unlock_irqrestore(&priv->lock, flags);
ipoib_send(dev, skb, mcast->ah, IB_MULTICAST_QPN);
return;
next prev parent reply other threads:[~2011-12-07 16:36 UTC|newest]
Thread overview: 111+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 16:12 [000/104] 3.1.5-stable review Greg KH
2011-12-07 16:11 ` [001/104] eCryptfs: Prevent file create race condition Greg KH
2011-12-07 16:11 ` [002/104] eCryptfs: Flush file in vma close Greg KH
2011-12-07 16:11 ` [003/104] i2c-algo-bit: Generate correct i2c address sequence for 10-bit target Greg KH
2011-12-07 16:11 ` [004/104] eCryptfs: Extend array bounds for all filename chars Greg KH
2011-12-07 16:11 ` [005/104] crypto: mv_cesa - fix hashing of chunks > 1920 bytes Greg KH
2011-12-07 16:11 ` [006/104] drm: integer overflow in drm_mode_dirtyfb_ioctl() Greg KH
2011-12-07 16:11 ` [007/104] drm/radeon/kms: fix up gpio i2c mask bits for r4xx for real Greg KH
2011-12-07 16:11 ` [008/104] drm/i915: Ivybridge still has fences! Greg KH
2011-12-07 16:11 ` [009/104] drm/i915: Turn on a required 3D clock gating bit on Sandybridge Greg KH
2011-12-07 16:11 ` [010/104] drm/i915: Turn on another required clock gating bit on gen6 Greg KH
2011-12-07 16:11 ` [011/104] drm/i915: Fix inconsistent backlight level during disabled Greg KH
2011-12-07 16:11 ` [012/104] PCI hotplug: shpchp: dont blindly claim non-AMD 0x7450 device IDs Greg KH
2011-12-07 16:11 ` [013/104] drm/radeon/kms: fix up gpio i2c mask bits for r4xx Greg KH
2011-12-07 16:11 ` [014/104] viafb: correct sync polarity for OLPC DCON Greg KH
2011-12-07 16:11 ` [015/104] ARM: pxa: fix inconsistent CONFIG_USB_PXA27X Greg KH
2011-12-07 16:11 ` [016/104] arm: mx28: fix bit operation in clock setting Greg KH
2011-12-07 16:11 ` [017/104] ARM: OMAP: smartreflex: fix IRQ handling bug Greg KH
2011-12-07 16:11 ` [018/104] ARM: OMAP: hwmod: Fix the addr space, irq, dma count APIs Greg KH
2011-12-07 16:11 ` [019/104] ARM: OMAP2: select ARM_AMBA if OMAP3_EMU is defined Greg KH
2011-12-07 16:11 ` [020/104] ARM: OMAP: PM: only register TWL with voltage layer when device is present Greg KH
2011-12-07 16:11 ` [021/104] ARM: 7161/1: errata: no automatic store buffer drain Greg KH
2011-12-07 16:11 ` [022/104] ALSA: hda - Fix jack-detection control of VT1708 Greg KH
2011-12-07 16:11 ` [023/104] ALSA: lx6464es - fix device communication via command bus Greg KH
2011-12-07 16:11 ` [024/104] ALSA: hda/realtek - Fix missing inits of item indices for auto-mic Greg KH
2011-12-07 16:11 ` [025/104] ASoC: sta32x: preserve coefficient RAM Greg KH
2011-12-07 16:11 ` [026/104] ASoC: fsl_ssi: properly initialize the sysfs attribute object Greg KH
2011-12-07 16:11 ` [027/104] ASoC: wm8753: Skip noop reconfiguration of DAI mode Greg KH
2011-12-07 16:11 ` [028/104] ASoC: Ensure WM8731 register cache is synced when resuming from disabled Greg KH
2011-12-07 16:11 ` [029/104] SUNRPC: Ensure we return EAGAIN in xs_nospace if congestion is cleared Greg KH
2011-12-07 16:11 ` [030/104] ext4: fix racy use-after-free in ext4_end_io_dio() Greg KH
2011-12-07 16:11 ` [031/104] rtlwifi: fix lps_lock deadlock Greg KH
2011-12-07 16:11 ` [032/104] genirq: fix regression in irqfixup, irqpoll Greg KH
2011-12-07 16:11 ` [033/104] regulator: aat2870: Fix the logic of checking if no id is matched in aat2870_get_regulator Greg KH
2011-12-07 16:11 ` [034/104] regulator: twl: fix twl4030 support for smps regulators Greg KH
2011-12-07 16:11 ` [035/104] cgroup_freezer: fix freezing groups with stopped tasks Greg KH
2011-12-07 16:11 ` [036/104] timekeeping: add arch_offset hook to ktime_get functions Greg KH
2011-12-07 16:11 ` [037/104] hrtimer: Fix extra wakeups from __remove_hrtimer() Greg KH
2011-12-07 16:11 ` [038/104] clocksource: Avoid selecting mult values that might overflow when adjusted Greg KH
2011-12-07 16:11 ` [039/104] p54spi: Add missing spin_lock_init Greg KH
2011-12-07 16:11 ` [040/104] p54spi: Fix workqueue deadlock Greg KH
2011-12-07 16:11 ` [041/104] rt2x00: Fix efuse EEPROM reading on PPC32 Greg KH
2011-12-07 16:11 ` [042/104] nl80211: fix MAC address validation Greg KH
2011-12-07 16:11 ` [043/104] cfg80211: fix regulatory NULL dereference Greg KH
2011-12-07 16:11 ` [044/104] mac80211: dont stop a single aggregation session twice Greg KH
2011-12-07 16:11 ` [045/104] mac80211: fix race between the AGG SM and the Tx data path Greg KH
2011-12-07 16:11 ` [046/104] xfs: dont serialise direct IO reads on page cache checks Greg KH
2011-12-07 16:11 ` [047/104] xfs: avoid direct I/O write vs buffered I/O race Greg KH
2011-12-07 16:11 ` [048/104] xfs: Return -EIO when xfs_vn_getattr() failed Greg KH
2011-12-07 16:11 ` [049/104] xfs: fix buffer flushing during unmount Greg KH
2011-12-07 16:11 ` [050/104] xfs: Fix possible memory corruption in xfs_readlink Greg KH
2011-12-07 16:11 ` [051/104] xfs: use doalloc flag in xfs_qm_dqattach_one() Greg KH
2011-12-07 16:11 ` [052/104] SCSI: Silencing killing requests for dead queue Greg KH
2011-12-07 16:11 ` [053/104] hugetlb: release pages in the error path of hugetlb_cow() Greg KH
2011-12-07 16:11 ` [054/104] bridge: correct IPv6 checksum after pull Greg KH
2011-12-07 16:11 ` [055/104] iwlwifi: allow pci_enable_msi fail Greg KH
2011-12-07 16:11 ` [056/104] drm/radeon/kms: add some new pci ids Greg KH
2011-12-07 16:11 ` [057/104] drm/radeon/kms: add some loop timeouts in pageflip code Greg KH
2011-12-07 16:12 ` [058/104] ALSA: hda - Fix S3/S4 problem on machines with VREF-pin mute-LED Greg KH
2011-12-07 16:12 ` [059/104] ASoC: Fix wrong define for AD1836_ADC_WORD_OFFSET Greg KH
2011-12-07 16:12 ` [060/104] firmware: Sigma: Prevent out of bounds memory access Greg KH
2011-12-07 16:12 ` [061/104] firmware: Sigma: Skip header during CRC generation Greg KH
2011-12-07 16:12 ` [062/104] firmware: Sigma: Fix endianess issues Greg KH
2011-12-07 16:12 ` [063/104] staging:rts_pstor:Complete scanning_done variable Greg KH
2011-12-07 16:12 ` [064/104] staging: usbip: bugfix for deadlock Greg KH
2011-12-07 16:12 ` [065/104] staging: comedi: fix oops for USB DAQ devices Greg KH
2011-12-07 16:12 ` [066/104] Staging: comedi: fix mmap_count Greg KH
2011-12-07 16:12 ` [067/104] Staging: comedi: fix signal handling in read and write Greg KH
2011-12-07 16:12 ` [068/104] usb: musb: PM: fix context save/restore in suspend/resume path Greg KH
2011-12-07 16:12 ` [069/104] USB: whci-hcd: fix endian conversion in qset_clear() Greg KH
2011-12-07 16:12 ` [070/104] HID: Correct General touch PID Greg KH
2011-12-07 16:12 ` [071/104] usb: ftdi_sio: add PID for Propox ISPcable III Greg KH
2011-12-07 16:12 ` [072/104] usb: option: add Huawei E353 controlling interfaces Greg KH
2011-12-07 16:12 ` [073/104] usb: option: add SIMCom SIM5218 Greg KH
2011-12-07 16:12 ` [074/104] USB: usb-storage: unusual_devs entry for Kingston DT 101 G2 Greg KH
2011-12-07 16:12 ` Greg KH [this message]
2011-12-07 16:12 ` [076/104] USB: EHCI: fix HUB TT scheduling issue with iso transfer Greg KH
2011-12-07 16:12 ` [077/104] EHCI : Fix a regression in the ISO scheduler Greg KH
2011-12-07 16:12 ` [078/104] xHCI: fix bug in xhci_clear_command_ring() Greg KH
2011-12-07 16:12 ` [079/104] sched, x86: Avoid unnecessary overflow in sched_clock Greg KH
2011-12-07 16:12 ` [080/104] x86/mpparse: Account for bus types other than ISA and PCI Greg KH
2011-12-07 16:12 ` [081/104] x86: Fix "Acer Aspire 1" reboot hang Greg KH
2011-12-07 16:12 ` [082/104] x86/paravirt: PTE updates in k(un)map_atomic need to be synchronous, regardless of lazy_mmu mode Greg KH
2011-12-07 16:12 ` [083/104] perf/x86: Fix PEBS instruction unwind Greg KH
2011-12-07 16:12 ` [084/104] oprofile, x86: Fix crash when unloading module (nmi timer mode) Greg KH
2011-12-07 16:12 ` [085/104] [S390] add missing .set function for NT_S390_LAST_BREAK regset Greg KH
2011-12-07 16:12 ` [086/104] mac80211: fill rate filter for internal scan requests Greg KH
2011-12-07 16:12 ` [087/104] mac80211: fix race condition caused by late addBA response Greg KH
2011-12-07 16:12 ` [088/104] cfg80211: fix race on init and driver registration Greg KH
2011-12-07 16:12 ` [089/104] cfg80211: amend regulatory NULL dereference fix Greg KH
2011-12-07 16:12 ` [090/104] genirq: Fix race condition when stopping the irq thread Greg KH
2011-12-07 16:12 ` [091/104] slab, lockdep: Fix silly bug Greg KH
2011-12-07 16:12 ` [092/104] iwlwifi: do not re-configure HT40 after associated Greg KH
2011-12-07 15:29 ` Guy, Wey-Yi
2011-12-07 16:38 ` Greg KH
2011-12-07 16:12 ` [093/104] iwlagn: fix HW crypto for TX-only keys Greg KH
2011-12-07 16:12 ` [094/104] ftrace: Remove force undef config value left for testing Greg KH
2011-12-07 16:12 ` [095/104] trace_events_filter: Use rcu_assign_pointer() when setting ftrace_event_call->filter Greg KH
2011-12-07 16:12 ` [096/104] rtc: Disable the alarm in the hardware Greg KH
2012-01-03 16:27 ` Jonathan Nieder
2012-01-03 16:42 ` Greg KH
2012-01-03 18:27 ` Jonathan Nieder
2011-12-07 16:12 ` [097/104] rtc: Fix some bugs that allowed accumulating time drift in suspend/resume Greg KH
2011-12-07 16:12 ` [098/104] tracing: fix event_subsystem ref counting Greg KH
2011-12-07 16:12 ` [099/104] tick-broadcast: Stop active broadcast device when replacing it Greg KH
2011-12-07 16:12 ` [100/104] perf: Fix parsing of __print_flags() in TP_printk() Greg KH
2011-12-07 16:12 ` [101/104] jump_label: jump_label_inc may return before the code is patched Greg KH
2011-12-07 16:12 ` [102/104] oprofile: Fix crash when unloading module (hr timer mode) Greg KH
2011-12-07 16:12 ` [103/104] clocksource: Fix bug with max_deferment margin calculation Greg KH
2011-12-07 16:12 ` [104/104] clockevents: Set noop handler in clockevents_exchange_device() Greg KH
2011-12-07 22:12 ` [000/104] 3.1.5-stable review Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111207161220.956687641@clark.kroah.org \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@purestorage.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®