mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.0 020/105] net_sched: invoke ->attach() after setting dev->qdisc
Date: Fri, 19 Jun 2015 13:35:10 -0700	[thread overview]
Message-ID: <20150619203558.810135295@linuxfoundation.org> (raw)
In-Reply-To: <20150619203558.187802739@linuxfoundation.org>

4.0-stable review patch.  If anyone has any objections, please let me know.

------------------

From: WANG Cong <xiyou.wangcong@gmail.com>

[ Upstream commit 86e363dc3b50bfd50a1f315934583fbda673ab8d ]

For mq qdisc, we add per tx queue qdisc to root qdisc
for display purpose, however, that happens too early,
before the new dev->qdisc is finally set, this causes
q->list points to an old root qdisc which is going to be
freed right before assigning with a new one.

Fix this by moving ->attach() after setting dev->qdisc.

For the record, this fixes the following crash:

 ------------[ cut here ]------------
 WARNING: CPU: 1 PID: 975 at lib/list_debug.c:59 __list_del_entry+0x5a/0x98()
 list_del corruption. prev->next should be ffff8800d1998ae8, but was 6b6b6b6b6b6b6b6b
 CPU: 1 PID: 975 Comm: tc Not tainted 4.1.0-rc4+ #1019
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  0000000000000009 ffff8800d73fb928 ffffffff81a44e7f 0000000047574756
  ffff8800d73fb978 ffff8800d73fb968 ffffffff810790da ffff8800cfc4cd20
  ffffffff814e725b ffff8800d1998ae8 ffffffff82381250 0000000000000000
 Call Trace:
  [<ffffffff81a44e7f>] dump_stack+0x4c/0x65
  [<ffffffff810790da>] warn_slowpath_common+0x9c/0xb6
  [<ffffffff814e725b>] ? __list_del_entry+0x5a/0x98
  [<ffffffff81079162>] warn_slowpath_fmt+0x46/0x48
  [<ffffffff81820eb0>] ? dev_graft_qdisc+0x5e/0x6a
  [<ffffffff814e725b>] __list_del_entry+0x5a/0x98
  [<ffffffff814e72a7>] list_del+0xe/0x2d
  [<ffffffff81822f05>] qdisc_list_del+0x1e/0x20
  [<ffffffff81820cd1>] qdisc_destroy+0x30/0xd6
  [<ffffffff81822676>] qdisc_graft+0x11d/0x243
  [<ffffffff818233c1>] tc_get_qdisc+0x1a6/0x1d4
  [<ffffffff810b5eaf>] ? mark_lock+0x2e/0x226
  [<ffffffff817ff8f5>] rtnetlink_rcv_msg+0x181/0x194
  [<ffffffff817ff72e>] ? rtnl_lock+0x17/0x19
  [<ffffffff817ff72e>] ? rtnl_lock+0x17/0x19
  [<ffffffff817ff774>] ? __rtnl_unlock+0x17/0x17
  [<ffffffff81855dc6>] netlink_rcv_skb+0x4d/0x93
  [<ffffffff817ff756>] rtnetlink_rcv+0x26/0x2d
  [<ffffffff818544b2>] netlink_unicast+0xcb/0x150
  [<ffffffff81161db9>] ? might_fault+0x59/0xa9
  [<ffffffff81854f78>] netlink_sendmsg+0x4fa/0x51c
  [<ffffffff817d6e09>] sock_sendmsg_nosec+0x12/0x1d
  [<ffffffff817d8967>] sock_sendmsg+0x29/0x2e
  [<ffffffff817d8cf3>] ___sys_sendmsg+0x1b4/0x23a
  [<ffffffff8100a1b8>] ? native_sched_clock+0x35/0x37
  [<ffffffff810a1d83>] ? sched_clock_local+0x12/0x72
  [<ffffffff810a1fd4>] ? sched_clock_cpu+0x9e/0xb7
  [<ffffffff810def2a>] ? current_kernel_time+0xe/0x32
  [<ffffffff810b4bc5>] ? lock_release_holdtime.part.29+0x71/0x7f
  [<ffffffff810ddebf>] ? read_seqcount_begin.constprop.27+0x5f/0x76
  [<ffffffff810b6292>] ? trace_hardirqs_on_caller+0x17d/0x199
  [<ffffffff811b14d5>] ? __fget_light+0x50/0x78
  [<ffffffff817d9808>] __sys_sendmsg+0x42/0x60
  [<ffffffff817d9838>] SyS_sendmsg+0x12/0x1c
  [<ffffffff81a50e97>] system_call_fastpath+0x12/0x6f
 ---[ end trace ef29d3fb28e97ae7 ]---

For long term, we probably need to clean up the qdisc_graft() code
in case it hides other bugs like this.

Fixes: 95dc19299f74 ("pkt_sched: give visibility to mq slave qdiscs")
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/sched/sch_api.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -815,10 +815,8 @@ static int qdisc_graft(struct net_device
 		if (dev->flags & IFF_UP)
 			dev_deactivate(dev);
 
-		if (new && new->ops->attach) {
-			new->ops->attach(new);
-			num_q = 0;
-		}
+		if (new && new->ops->attach)
+			goto skip;
 
 		for (i = 0; i < num_q; i++) {
 			struct netdev_queue *dev_queue = dev_ingress_queue(dev);
@@ -834,12 +832,16 @@ static int qdisc_graft(struct net_device
 				qdisc_destroy(old);
 		}
 
+skip:
 		if (!ingress) {
 			notify_and_destroy(net, skb, n, classid,
 					   dev->qdisc, new);
 			if (new && !new->ops->attach)
 				atomic_inc(&new->refcnt);
 			dev->qdisc = new ? : &noop_qdisc;
+
+			if (new && new->ops->attach)
+				new->ops->attach(new);
 		} else {
 			notify_and_destroy(net, skb, n, classid, old, new);
 		}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

  parent reply	other threads:[~2015-06-19 20:39 UTC|newest]

Thread overview: 117+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 20:34 [PATCH 4.0 000/105] 4.0.6-stable review Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 001/105] crush: ensuring at most num-rep osds are selected Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 002/105] aio: fix serial draining in exit_aio() Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 003/105] net: core: Correct an over-stringent device loop detection Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 004/105] x86: bpf_jit: fix FROM_BE16 and FROM_LE16/32 instructions Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 005/105] x86: bpf_jit: fix compilation of large bpf programs Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 006/105] net: phy: Allow EEE for all RGMII variants Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 007/105] netlink: Reset portid after netlink_insert failure Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 008/105] rtnl/bond: dont send rtnl msg for unregistered iface Greg Kroah-Hartman
2015-06-19 20:34 ` [PATCH 4.0 009/105] tcp/ipv6: fix flow label setting in TIME_WAIT state Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 010/105] net/ipv6/udp: Fix ipv6 multicast socket filter regression Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 011/105] net: sched: fix call_rcu() race on classifier module unloads Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 012/105] ipv4: Avoid crashing in ip_error Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 014/105] bridge: fix parsing of MLDv2 reports Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 015/105] net: dp83640: fix broken calibration routine Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 016/105] net: dp83640: reinforce locking rules Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 017/105] net: dp83640: fix improper double spin locking Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 018/105] unix/caif: sk_socket can disappear when state is unlocked Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 019/105] xen/netback: Properly initialize credit_bytes Greg Kroah-Hartman
2015-06-19 20:35 ` Greg Kroah-Hartman [this message]
2015-06-19 20:35 ` [PATCH 4.0 021/105] sctp: Fix mangled IPv4 addresses on a IPv6 listening socket Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 023/105] udp: fix behavior of wrong checksums Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 024/105] tcp: fix child sockets to use system default congestion control if not set Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 025/105] xen: netback: read hotplug script once at start of day Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 026/105] ipv4/udp: Verify multicast group is ours in upd_v4_early_demux() Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 027/105] be2net: Replace dma/pci_alloc_coherent() calls with dma_zalloc_coherent() Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 028/105] bridge: disable softirqs around br_fdb_update to avoid lockup Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 029/105] netlink: Disable insertions/removals during rehash Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 030/105] iio: adc: twl6030-gpadc: Fix modalias Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 031/105] iio: adis16400: Report pressure channel scale Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 032/105] iio: adis16400: Use != channel indices for the two voltage channels Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 033/105] iio: adis16400: Compute the scan mask from channel indices Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 034/105] iio: adis16400: Fix burst mode Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 035/105] iio: adis16400: Fix burst transfer for adis16448 Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 036/105] drivers/base: cacheinfo: handle absence of caches Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 038/105] iommu/vt-d: Allow RMRR on graphics devices too Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 039/105] iommu/vt-d: Fix passthrough mode with translation-disabled devices Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 040/105] ALSA: hda/realtek - Add a fixup for another Acer Aspire 9420 Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 041/105] ALSA: usb-audio: Add mic volume fix quirk for Logitech Quickcam Fusion Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 042/105] ALSA: usb-audio: dont try to get Outlaw RR2150 sample rate Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 043/105] ALSA: usb-audio: add MAYA44 USB+ mixer control names Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 044/105] ALSA: usb-audio: fix missing input volume controls in MAYA44 USB(+) Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 045/105] ALSA: usb-audio: add native DSD support for JLsounds I2SoverUSB Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 046/105] dmaengine: pl330: Fix hang on dmaengine_terminate_all on certain boards Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 047/105] dmaengine: Fix choppy sound because of unimplemented resume Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 048/105] dmaengine: at_xdmac: rework slave configuration part Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 049/105] dmaengine: at_xdmac: lock fixes Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 050/105] i2c: hix5hd2: Fix modalias to make module auto-loading work Greg Kroah-Hartman
2015-06-22 14:23   ` Paul Bolle
2015-06-22 15:43     ` Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 051/105] i2c: s3c2410: fix oops in suspend callback for non-dt platforms Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 052/105] Input: alps - do not reduce trackpoint speed by half Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 053/105] Input: synaptics - add min/max quirk for Lenovo S540 Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 055/105] Input: elantech - add new icbody type Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 056/105] block: fix ext_dev_lock lockdep report Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 057/105] block: discard bdi_unregister() in favour of bdi_destroy() Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 058/105] USB: cp210x: add ID for HubZ dual ZigBee and Z-Wave dongle Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 059/105] USB: serial: ftdi_sio: Add support for a Motion Tracker Development Board Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 060/105] usb: dwc3: gadget: Fix incorrect DEPCMD and DGCMD status macros Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 061/105] usb: host: xhci: add mutex for non-thread-safe data Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 062/105] usb: make module xhci_hcd removable Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 063/105] x86/asm/irq: Stop relying on magic JMP behavior for early_idt_handlers Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 064/105] ring-buffer-benchmark: Fix the wrong sched_priority of producer Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 065/105] MIPS: ralink: Fix clearing the illegal access interrupt Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 066/105] MIPS: Fix enabling of DEBUG_STACKOVERFLOW Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 067/105] MIPS: KVM: Do not sign extend on unsigned MMIO load Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 068/105] ozwpan: Use proper check to prevent heap overflow Greg Kroah-Hartman
2015-06-19 20:35 ` [PATCH 4.0 069/105] ozwpan: Use unsigned ints " Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 070/105] ozwpan: divide-by-zero leading to panic Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 071/105] ozwpan: unchecked signed subtraction leads to DoS Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 072/105] pata_octeon_cf: fix broken build Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 073/105] ARM: dts: am335x-boneblack: disable RTC-only sleep to avoid hardware damage Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 074/105] drm/amdkfd: fix topology bug with capability attr Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 075/105] drm/radeon: use proper ACR regisiter for DCE3.2 Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 076/105] drm/i915/hsw: Fix workaround for server AUX channel clock divisor Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 080/105] Revert "drm/radeon: dont share plls if monitors differ in audio support" Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 081/105] Revert "drm/radeon: adjust pll when audio is not enabled" Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 083/105] serial: imx: Fix DMA handling for IDLE condition aborts Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 084/105] of/dynamic: Fix test for PPC_PSERIES Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 085/105] virtio_pci: Clear stale cpumask when setting irq affinity Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 086/105] ata: ahci_mvebu: Fix wrongly set base address for the MBus window setting Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 087/105] bus: mvebu-mbus: do not set WIN_CTRL_SYNCBARRIER on non io-coherent platforms Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 088/105] Revert "bus: mvebu-mbus: make sure SDRAM CS for DMA dont overlap the MBus bridge window" Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 089/105] arm64: dts: mt8173-evb: fix model name Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 090/105] mm/memory_hotplug.c: set zone->wait_table to null after freeing it Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 091/105] md: Close race when setting action to idle Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 092/105] md: dont return 0 from array_state_store Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 093/105] sched, numa: do not hint for NUMA balancing on VM_MIXEDMAP mappings Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 094/105] blk-mq: free hctx->ctxs in queues release handler Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 095/105] cfg80211: wext: clear sinfo struct before calling driver Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 096/105] irqchip: sunxi-nmi: Fix off-by-one error in irq iterator Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 097/105] x86/vdso: Fix the x86 vdso2c tool includes Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 098/105] x86/vdso: Fix make bzImage on older distros Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 099/105] Btrfs: send, add missing check for dead clone root Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 100/105] Btrfs: send, dont leave without decrementing clone roots send_progress Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 101/105] btrfs: incorrect handling for fiemap_fill_next_extent return Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 102/105] btrfs: cleanup orphans while looking up default subvolume Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 103/105] Btrfs: fix range cloning when same inode used as source and destination Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 104/105] Btrfs: fix uninit variable in clone ioctl Greg Kroah-Hartman
2015-06-19 20:36 ` [PATCH 4.0 105/105] Btrfs: fix regression in raid level conversion Greg Kroah-Hartman
2015-06-20  1:12 ` [PATCH 4.0 000/105] 4.0.6-stable review Shuah Khan
2015-06-22 15:41   ` Greg Kroah-Hartman
2015-06-20  1:27 ` Guenter Roeck
2015-06-22 15:42   ` Greg Kroah-Hartman
2015-06-20  7:48 ` Sudip Mukherjee
2015-06-22 15:42   ` Greg Kroah-Hartman
2015-06-22 16:07     ` Sudip Mukherjee
2015-06-22 16:13       ` Greg Kroah-Hartman
2015-06-20  7:58 ` Heinz Diehl
2015-06-20 14:43   ` Greg Kroah-Hartman
2015-06-20 17:18     ` Heinz Diehl
2015-06-20 19:16       ` Greg Kroah-Hartman
     [not found] ` <20150619203600.449494173@linuxfoundation.org>
2015-06-23  7:29   ` [PATCH 4.0 077/105] drm/i915: Dont skip request retirement if the active list is empty Jani Nikula
2015-06-24 14:58     ` Greg Kroah-Hartman
2015-06-25  7:34       ` Jani Nikula
2015-06-25 14:48         ` Greg Kroah-Hartman
2015-06-25 15:22           ` Jani Nikula

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=20150619203558.810135295@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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

Powered by JetHome