stable.vger.kernel.org archive mirror
 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, Mark Wu <wudxw@linux.vnet.ibm.com>,
	Jay Vosburgh <fubar@us.ibm.com>,
	Andy Gospodarek <andy@greyhouse.net>,
	"David S. Miller" <davem@davemloft.net>
Subject: [ 16/48] bonding: Fix broken promiscuity reference counting issue
Date: Fri, 11 Oct 2013 12:36:23 -0700	[thread overview]
Message-ID: <20131011193639.023335278@linuxfoundation.org> (raw)
In-Reply-To: <20131011193637.253208688@linuxfoundation.org>

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

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

From: Neil Horman <nhorman@tuxdriver.com>

[ Upstream commit 5a0068deb611109c5ba77358be533f763f395ee4 ]

Recently grabbed this report:
https://bugzilla.redhat.com/show_bug.cgi?id=1005567

Of an issue in which the bonding driver, with an attached vlan encountered the
following errors when bond0 was taken down and back up:

dummy1: promiscuity touches roof, set promiscuity failed. promiscuity feature of
device might be broken.

The error occurs because, during __bond_release_one, if we release our last
slave, we take on a random mac address and issue a NETDEV_CHANGEADDR
notification.  With an attached vlan, the vlan may see that the vlan and bond
mac address were in sync, but no longer are.  This triggers a call to dev_uc_add
and dev_set_rx_mode, which enables IFF_PROMISC on the bond device.  Then, when
we complete __bond_release_one, we use the current state of the bond flags to
determine if we should decrement the promiscuity of the releasing slave.  But
since the bond changed promiscuity state during the release operation, we
incorrectly decrement the slave promisc count when it wasn't in promiscuous mode
to begin with, causing the above error

Fix is pretty simple, just cache the bonding flags at the start of the function
and use those when determining the need to set promiscuity.

This is also needed for the ALLMULTI flag

Reported-by: Mark Wu <wudxw@linux.vnet.ibm.com>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: Mark Wu <wudxw@linux.vnet.ibm.com>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/bonding/bond_main.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1933,6 +1933,7 @@ int bond_release(struct net_device *bond
 	struct bonding *bond = netdev_priv(bond_dev);
 	struct slave *slave, *oldcurrent;
 	struct sockaddr addr;
+	int old_flags = bond_dev->flags;
 	netdev_features_t old_features = bond_dev->features;
 
 	/* slave is not a slave or master is not master of this slave */
@@ -2066,12 +2067,18 @@ int bond_release(struct net_device *bond
 	 * already taken care of above when we detached the slave
 	 */
 	if (!USES_PRIMARY(bond->params.mode)) {
-		/* unset promiscuity level from slave */
-		if (bond_dev->flags & IFF_PROMISC)
+		/* unset promiscuity level from slave
+		 * NOTE: The NETDEV_CHANGEADDR call above may change the value
+		 * of the IFF_PROMISC flag in the bond_dev, but we need the
+		 * value of that flag before that change, as that was the value
+		 * when this slave was attached, so we cache at the start of the
+		 * function and use it here. Same goes for ALLMULTI below
+		 */
+		if (old_flags & IFF_PROMISC)
 			dev_set_promiscuity(slave_dev, -1);
 
 		/* unset allmulti level from slave */
-		if (bond_dev->flags & IFF_ALLMULTI)
+		if (old_flags & IFF_ALLMULTI)
 			dev_set_allmulti(slave_dev, -1);
 
 		/* flush master's mc_list from slave */



  parent reply	other threads:[~2013-10-11 19:36 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 19:36 [ 00/48] 3.4.66-stable review Greg Kroah-Hartman
2013-10-11 19:36 ` [ 01/48] cpqarray: fix info leak in ida_locked_ioctl() Greg Kroah-Hartman
2013-10-11 19:36 ` [ 02/48] cciss: fix info leak in cciss_ioctl32_passthru() Greg Kroah-Hartman
2013-10-11 19:36 ` [ 03/48] gianfar: Change default HW Tx queue scheduling mode Greg Kroah-Hartman
2013-10-11 19:36 ` [ 04/48] caif: Add missing braces to multiline if in cfctrl_linkup_request Greg Kroah-Hartman
2013-10-11 19:36 ` [ 05/48] net: sctp: fix smatch warning in sctp_send_asconf_del_ip Greg Kroah-Hartman
2013-10-11 19:36 ` [ 06/48] net: flow_dissector: fix thoff for IPPROTO_AH Greg Kroah-Hartman
2013-10-11 19:36 ` [ 07/48] netpoll: fix NULL pointer dereference in netpoll_cleanup Greg Kroah-Hartman
2013-10-11 19:36 ` [ 08/48] net: sctp: fix ipv6 ipsec encryption bug in sctp_v6_xmit Greg Kroah-Hartman
2013-10-11 19:36 ` [ 09/48] resubmit bridge: fix message_age_timer calculation Greg Kroah-Hartman
2013-10-11 19:36 ` [ 10/48] bridge: Clamp forward_delay when enabling STP Greg Kroah-Hartman
2013-10-11 19:36 ` [ 11/48] ip: use ip_hdr() in __ip_make_skb() to retrieve IP header Greg Kroah-Hartman
2013-10-11 19:36 ` [ 12/48] ip: generate unique IP identificator if local fragmentation is allowed Greg Kroah-Hartman
2013-10-11 19:36 ` [ 13/48] ipv6: udp packets following an UFO enqueued packet need also be handled by UFO Greg Kroah-Hartman
2013-10-11 19:36 ` [ 14/48] via-rhine: fix VLAN priority field (PCP, IEEE 802.1p) Greg Kroah-Hartman
2013-10-11 19:36 ` [ 15/48] dm9601: fix IFF_ALLMULTI handling Greg Kroah-Hartman
2013-10-11 19:36 ` Greg Kroah-Hartman [this message]
2013-10-11 19:36 ` [ 17/48] ipv4 igmp: use in_dev_put in timer handlers instead of __in_dev_put Greg Kroah-Hartman
2013-10-11 19:36 ` [ 18/48] ipv6 mcast: use in6_dev_put in timer handlers instead of __in6_dev_put Greg Kroah-Hartman
2013-10-11 19:36 ` [ 19/48] ll_temac: Reset dma descriptors indexes on ndo_open Greg Kroah-Hartman
2013-10-11 19:36 ` [ 20/48] ASoC: max98095: a couple array underflows Greg Kroah-Hartman
2013-10-11 19:36 ` [ 21/48] ASoC: 88pm860x: array overflow in snd_soc_put_volsw_2r_st() Greg Kroah-Hartman
2013-10-11 19:36 ` [ 22/48] powerpc/iommu: Use GFP_KERNEL instead of GFP_ATOMIC in iommu_init_table() Greg Kroah-Hartman
2013-10-11 19:36 ` [ 23/48] powerpc/vio: Fix modalias_show return values Greg Kroah-Hartman
2013-10-11 19:36 ` [ 24/48] powerpc: Fix parameter clobber in csum_partial_copy_generic() Greg Kroah-Hartman
2013-10-11 19:36 ` [ 25/48] powerpc: Restore registers on error exit from csum_partial_copy_generic() Greg Kroah-Hartman
2013-10-11 19:36 ` [ 26/48] Bluetooth: Fix security level for peripheral role Greg Kroah-Hartman
2013-10-11 19:36 ` [ 27/48] Bluetooth: Fix encryption key size " Greg Kroah-Hartman
2013-10-11 19:36 ` [ 28/48] esp_scsi: Fix tag state corruption when autosensing Greg Kroah-Hartman
2013-10-11 19:36 ` [ 29/48] sparc64: Fix ITLB handler of null page Greg Kroah-Hartman
2013-10-11 19:36 ` [ 30/48] sparc64: Remove RWSEM export leftovers Greg Kroah-Hartman
2013-10-11 19:36 ` [ 31/48] sparc64: Fix off by one in trampoline TLB mapping installation loop Greg Kroah-Hartman
2013-10-11 19:36 ` [ 32/48] sparc64: Fix not SRAed %o5 in 32-bit traced syscall Greg Kroah-Hartman
2013-10-11 19:36 ` [ 33/48] sparc32: Fix exit flag passed from traced sys_sigreturn Greg Kroah-Hartman
2013-10-11 19:36 ` [ 34/48] kernel/kmod.c: check for NULL in call_usermodehelper_exec() Greg Kroah-Hartman
2013-10-11 22:36   ` Tetsuo Handa
2013-10-13 21:50     ` Greg KH
2013-10-11 19:36 ` [ 35/48] USB: serial: option: Ignore card reader interface on Huawei E1750 Greg Kroah-Hartman
2013-10-11 19:36 ` [ 36/48] ib_srpt: Destroy cm_id before destroying QP Greg Kroah-Hartman
2013-10-11 19:36 ` [ 37/48] ib_srpt: always set response for task management Greg Kroah-Hartman
2013-10-11 19:36 ` [ 38/48] rtlwifi: Align private space in rtl_priv struct Greg Kroah-Hartman
2013-10-11 19:36 ` [ 39/48] p54usb: add USB ID for Corega WLUSB2GTST USB adapter Greg Kroah-Hartman
2013-10-11 19:36 ` [ 40/48] dmaengine: imx-dma: fix lockdep issue between irqhandler and tasklet Greg Kroah-Hartman
2013-10-11 19:36 ` [ 41/48] dmaengine: imx-dma: fix callback path in tasklet Greg Kroah-Hartman
2013-10-11 19:36 ` [ 42/48] dmaengine: imx-dma: fix slow path issue in prep_dma_cyclic Greg Kroah-Hartman
2013-10-11 19:36 ` [ 43/48] staging: comedi: ni_65xx: (bug fix) confine insn_bits to one subdevice Greg Kroah-Hartman
2013-10-11 19:36 ` [ 44/48] mm, show_mem: suppress page counts in non-blockable contexts Greg Kroah-Hartman
2013-10-11 19:36 ` [ 45/48] ACPI / IPMI: Fix atomic context requirement of ipmi_msg_handler() Greg Kroah-Hartman
2013-10-11 19:36 ` [ 46/48] tile: use a more conservative __my_cpu_offset in CONFIG_PREEMPT Greg Kroah-Hartman
2013-10-11 19:36 ` [ 47/48] Btrfs: change how we queue blocks for backref checking Greg Kroah-Hartman
2013-10-11 19:36 ` [ 48/48] ext4: avoid hang when mounting non-journal filesystems with orphan list Greg Kroah-Hartman
2013-10-11 21:56 ` [ 00/48] 3.4.66-stable review Guenter Roeck
2013-10-11 22:12   ` Greg Kroah-Hartman
2013-10-12  0:50     ` Guenter Roeck
2013-10-13 16:04       ` Greg Kroah-Hartman
2013-10-17 13:16   ` Ben Hutchings
2013-10-11 22:15 ` Greg Kroah-Hartman

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=20131011193639.023335278@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wudxw@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).