From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>
Subject: [ 022/110] bridge: Clamp forward_delay when enabling STP
Date: Fri, 11 Oct 2013 12:38:02 -0700 [thread overview]
Message-ID: <20131011193810.088075785@linuxfoundation.org> (raw)
In-Reply-To: <20131011193807.584188672@linuxfoundation.org>
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <herbert@gondor.apana.org.au>
[ Upstream commit be4f154d5ef0ca147ab6bcd38857a774133f5450 ]
At some point limits were added to forward_delay. However, the
limits are only enforced when STP is enabled. This created a
scenario where you could have a value outside the allowed range
while STP is disabled, which then stuck around even after STP
is enabled.
This patch fixes this by clamping the value when we enable STP.
I had to move the locking around a bit to ensure that there is
no window where someone could insert a value outside the range
while we're in the middle of enabling STP.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/bridge/br_private.h | 1 +
net/bridge/br_stp.c | 21 +++++++++++++++------
net/bridge/br_stp_if.c | 12 ++++++++++--
3 files changed, 26 insertions(+), 8 deletions(-)
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -714,6 +714,7 @@ extern struct net_bridge_port *br_get_po
extern void br_init_port(struct net_bridge_port *p);
extern void br_become_designated_port(struct net_bridge_port *p);
+extern void __br_set_forward_delay(struct net_bridge *br, unsigned long t);
extern int br_set_forward_delay(struct net_bridge *br, unsigned long x);
extern int br_set_hello_time(struct net_bridge *br, unsigned long x);
extern int br_set_max_age(struct net_bridge *br, unsigned long x);
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -544,18 +544,27 @@ int br_set_max_age(struct net_bridge *br
}
+void __br_set_forward_delay(struct net_bridge *br, unsigned long t)
+{
+ br->bridge_forward_delay = t;
+ if (br_is_root_bridge(br))
+ br->forward_delay = br->bridge_forward_delay;
+}
+
int br_set_forward_delay(struct net_bridge *br, unsigned long val)
{
unsigned long t = clock_t_to_jiffies(val);
+ int err = -ERANGE;
+ spin_lock_bh(&br->lock);
if (br->stp_enabled != BR_NO_STP &&
(t < BR_MIN_FORWARD_DELAY || t > BR_MAX_FORWARD_DELAY))
- return -ERANGE;
+ goto unlock;
- spin_lock_bh(&br->lock);
- br->bridge_forward_delay = t;
- if (br_is_root_bridge(br))
- br->forward_delay = br->bridge_forward_delay;
+ __br_set_forward_delay(br, t);
+ err = 0;
+
+unlock:
spin_unlock_bh(&br->lock);
- return 0;
+ return err;
}
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -129,6 +129,14 @@ static void br_stp_start(struct net_brid
char *envp[] = { NULL };
r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC);
+
+ spin_lock_bh(&br->lock);
+
+ if (br->bridge_forward_delay < BR_MIN_FORWARD_DELAY)
+ __br_set_forward_delay(br, BR_MIN_FORWARD_DELAY);
+ else if (br->bridge_forward_delay < BR_MAX_FORWARD_DELAY)
+ __br_set_forward_delay(br, BR_MAX_FORWARD_DELAY);
+
if (r == 0) {
br->stp_enabled = BR_USER_STP;
br_debug(br, "userspace STP started\n");
@@ -137,10 +145,10 @@ static void br_stp_start(struct net_brid
br_debug(br, "using kernel STP\n");
/* To start timers on any ports left in blocking */
- spin_lock_bh(&br->lock);
br_port_state_selection(br);
- spin_unlock_bh(&br->lock);
}
+
+ spin_unlock_bh(&br->lock);
}
static void br_stp_stop(struct net_bridge *br)
next prev parent reply other threads:[~2013-10-11 19:38 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 19:37 [ 000/110] 3.10.16-stable review Greg Kroah-Hartman
2013-10-11 19:37 ` [ 001/110] mwifiex: fix memory corruption when unsetting multicast list Greg Kroah-Hartman
2013-10-11 19:37 ` [ 002/110] cpqarray: fix info leak in ida_locked_ioctl() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 003/110] cciss: fix info leak in cciss_ioctl32_passthru() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 004/110] HID: fix data access in implement() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 005/110] HID: fix unused rsize usage Greg Kroah-Hartman
2013-10-11 19:37 ` [ 006/110] caif: Add missing braces to multiline if in cfctrl_linkup_request Greg Kroah-Hartman
2013-10-11 19:37 ` [ 007/110] tcp: Add missing braces to do_tcp_setsockopt Greg Kroah-Hartman
2013-10-11 19:37 ` [ 008/110] ipv6/exthdrs: accept tlv which includes only padding Greg Kroah-Hartman
2013-10-11 19:37 ` [ 009/110] net: fib: fib6_add: fix potential NULL pointer dereference Greg Kroah-Hartman
2013-10-11 19:37 ` [ 010/110] net: sctp: fix bug in sctp_poll for SOCK_SELECT_ERR_QUEUE Greg Kroah-Hartman
2013-10-11 19:37 ` [ 011/110] net: sctp: fix smatch warning in sctp_send_asconf_del_ip Greg Kroah-Hartman
2013-10-11 19:37 ` [ 012/110] net: fix multiqueue selection Greg Kroah-Hartman
2013-10-11 19:37 ` [ 013/110] net: flow_dissector: fix thoff for IPPROTO_AH Greg Kroah-Hartman
2013-10-11 19:37 ` [ 014/110] net_sched: htb: fix a typo in htb_change_class() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 015/110] r8169: enforce RX_MULTI_EN for the 8168f Greg Kroah-Hartman
2013-10-11 19:37 ` [ 016/110] netpoll: Should handle ETH_P_ARP other than ETH_P_IP in netpoll_neigh_reply Greg Kroah-Hartman
2013-10-11 19:37 ` [ 017/110] netpoll: fix NULL pointer dereference in netpoll_cleanup Greg Kroah-Hartman
2013-10-11 19:37 ` [ 018/110] tuntap: correctly handle error in tun_set_iff() Greg Kroah-Hartman
2013-10-11 19:37 ` [ 019/110] net: sctp: fix ipv6 ipsec encryption bug in sctp_v6_xmit Greg Kroah-Hartman
2013-10-11 19:38 ` [ 020/110] xen-netback: count number required slots for an skb more carefully Greg Kroah-Hartman
2013-10-11 19:38 ` [ 021/110] resubmit bridge: fix message_age_timer calculation Greg Kroah-Hartman
2013-10-11 19:38 ` Greg Kroah-Hartman [this message]
2013-10-11 19:38 ` [ 023/110] bridge: use br_port_get_rtnl within rtnl lock Greg Kroah-Hartman
2013-10-11 19:38 ` [ 024/110] bridge: fix NULL pointer deref of br_port_get_rcu Greg Kroah-Hartman
2013-10-11 19:38 ` [ 025/110] ip6_tunnels: raddr and laddr are inverted in nl msg Greg Kroah-Hartman
2013-10-11 19:38 ` [ 026/110] net: sctp: rfc4443: do not report ICMP redirects to user space Greg Kroah-Hartman
2013-10-11 19:38 ` [ 027/110] net:dccp: " Greg Kroah-Hartman
2013-10-11 19:38 ` [ 028/110] ip: use ip_hdr() in __ip_make_skb() to retrieve IP header Greg Kroah-Hartman
2013-10-11 19:38 ` [ 029/110] ip: generate unique IP identificator if local fragmentation is allowed Greg Kroah-Hartman
2013-10-11 19:38 ` [ 030/110] ipv6: udp packets following an UFO enqueued packet need also be handled by UFO Greg Kroah-Hartman
2013-10-11 19:38 ` [ 031/110] via-rhine: fix VLAN priority field (PCP, IEEE 802.1p) Greg Kroah-Hartman
2013-10-11 19:38 ` [ 032/110] IPv6 NAT: Do not drop DNATed 6to4/6rd packets Greg Kroah-Hartman
2013-10-11 19:38 ` [ 033/110] net: net_secret should not depend on TCP Greg Kroah-Hartman
2013-10-11 19:38 ` [ 034/110] dm9601: fix IFF_ALLMULTI handling Greg Kroah-Hartman
2013-10-11 19:38 ` [ 035/110] bonding: Fix broken promiscuity reference counting issue Greg Kroah-Hartman
2013-10-11 19:38 ` [ 036/110] ipv6: gre: correct calculation of max_headroom Greg Kroah-Hartman
2013-10-11 19:38 ` [ 037/110] ipv4 igmp: use in_dev_put in timer handlers instead of __in_dev_put Greg Kroah-Hartman
2013-10-11 19:38 ` [ 038/110] ipv6 mcast: use in6_dev_put in timer handlers instead of __in6_dev_put Greg Kroah-Hartman
2013-10-11 19:38 ` [ 039/110] ll_temac: Reset dma descriptors indexes on ndo_open Greg Kroah-Hartman
2013-10-11 19:38 ` [ 040/110] ip_tunnel: Fix a memory corruption in ip_tunnel_xmit Greg Kroah-Hartman
2013-10-11 19:38 ` [ 041/110] sit: allow to use rtnl ops on fb tunnel Greg Kroah-Hartman
2013-10-11 19:38 ` [ 042/110] ip6tnl: " Greg Kroah-Hartman
2013-10-11 19:38 ` [ 043/110] avr32: fix clockevents kernel warning Greg Kroah-Hartman
2013-10-11 19:38 ` [ 044/110] fs/binfmt_elf.c: prevent a coredump with a large vm_map_count from Oopsing Greg Kroah-Hartman
2013-10-11 19:38 ` [ 045/110] gpio/omap: maintain GPIO and IRQ usage separately Greg Kroah-Hartman
2013-10-11 19:38 ` [ 046/110] gpio/omap: auto-setup a GPIO when used as an IRQ Greg Kroah-Hartman
2013-10-11 19:38 ` [ 047/110] ASoC: max98095: a couple array underflows Greg Kroah-Hartman
2013-10-11 19:38 ` [ 048/110] ASoC: 88pm860x: array overflow in snd_soc_put_volsw_2r_st() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 049/110] ASoC: ab8500-codec: info leak in anc_status_control_put() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 050/110] powerpc/iommu: Use GFP_KERNEL instead of GFP_ATOMIC in iommu_init_table() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 051/110] powerpc/perf: Fix handling of FAB events Greg Kroah-Hartman
2013-10-11 19:38 ` [ 052/110] powerpc/tm: Switch out userspace PPR and DSCR sooner Greg Kroah-Hartman
2013-10-11 19:38 ` [ 053/110] powerpc/vio: Fix modalias_show return values Greg Kroah-Hartman
2013-10-11 19:38 ` [ 054/110] powerpc: Fix parameter clobber in csum_partial_copy_generic() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 055/110] powerpc/sysfs: Disable writing to PURR in guest mode Greg Kroah-Hartman
2013-10-11 19:38 ` [ 056/110] powerpc: Restore registers on error exit from csum_partial_copy_generic() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 057/110] fuse: wait for writeback in fuse_file_fallocate() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 058/110] fuse: fix fallocate vs. ftruncate race Greg Kroah-Hartman
2013-10-11 19:38 ` [ 059/110] brcmfmac: obtain platform data upon module initialization Greg Kroah-Hartman
2013-10-11 19:38 ` [ 060/110] Bluetooth: Fix security level for peripheral role Greg Kroah-Hartman
2013-10-11 19:38 ` [ 061/110] Bluetooth: Fix encryption key size " Greg Kroah-Hartman
2013-10-11 19:38 ` [ 062/110] Bluetooth: Add a new PID/VID 0cf3/e005 for AR3012 Greg Kroah-Hartman
2013-10-11 19:38 ` [ 063/110] Bluetooth: Add support for BCM20702A0 [0b05, 17cb] Greg Kroah-Hartman
2013-10-11 19:38 ` [ 064/110] Bluetooth: Introduce a new HCI_RFKILLED flag Greg Kroah-Hartman
2013-10-11 19:38 ` [ 065/110] Bluetooth: Fix rfkill functionality during the HCI setup stage Greg Kroah-Hartman
2013-10-11 19:38 ` [ 066/110] nilfs2: fix issue with race condition of competition between segments for dirty blocks Greg Kroah-Hartman
2013-10-11 19:38 ` [ 067/110] esp_scsi: Fix tag state corruption when autosensing Greg Kroah-Hartman
2013-10-11 19:38 ` [ 068/110] sparc64: Fix ITLB handler of null page Greg Kroah-Hartman
2013-10-11 19:38 ` [ 069/110] sparc64: Remove RWSEM export leftovers Greg Kroah-Hartman
2013-10-11 19:38 ` [ 070/110] sparc64: Fix buggy strlcpy() conversion in ldom_reboot() Greg Kroah-Hartman
2013-10-11 19:38 ` [ 071/110] sparc: fix ldom_reboot buffer overflow harder Greg Kroah-Hartman
2013-10-11 19:38 ` [ 072/110] sparc64: Fix off by one in trampoline TLB mapping installation loop Greg Kroah-Hartman
2013-10-11 19:38 ` [ 073/110] sparc64: Fix not SRAed %o5 in 32-bit traced syscall Greg Kroah-Hartman
2013-10-11 19:38 ` [ 074/110] sparc32: Fix exit flag passed from traced sys_sigreturn Greg Kroah-Hartman
2013-10-11 19:38 ` [ 075/110] mm: Fix generic hugetlb pte check return type Greg Kroah-Hartman
2013-10-11 19:38 ` [ 076/110] mm/bounce.c: fix a regression where MS_SNAP_STABLE (stable pages snapshotting) was ignored Greg Kroah-Hartman
2013-10-11 19:38 ` [ 077/110] kernel/kmod.c: check for NULL in call_usermodehelper_exec() Greg Kroah-Hartman
2013-10-11 22:36 ` Tetsuo Handa
2013-10-11 19:38 ` [ 078/110] staging: comedi: ni_65xx: (bug fix) confine insn_bits to one subdevice Greg Kroah-Hartman
2013-10-11 19:38 ` [ 079/110] NFSv4.1: nfs4_fl_prepare_ds - fix bugs when the connect attempt fails Greg Kroah-Hartman
2013-10-11 19:39 ` [ 080/110] mwifiex: fix NULL pointer dereference in usb suspend handler Greg Kroah-Hartman
2013-10-11 19:39 ` [ 081/110] mwifiex: fix hang issue for USB chipsets Greg Kroah-Hartman
2013-10-11 19:39 ` [ 082/110] mwifiex: fix PCIe hs_cfg cancel cmd timeout Greg Kroah-Hartman
2013-10-11 19:39 ` [ 083/110] USB: serial: option: Ignore card reader interface on Huawei E1750 Greg Kroah-Hartman
2013-10-11 19:39 ` [ 084/110] xen/hvc: allow xenboot console to be used again Greg Kroah-Hartman
2013-10-11 19:39 ` [ 085/110] ib_srpt: Destroy cm_id before destroying QP Greg Kroah-Hartman
2013-10-11 19:39 ` [ 086/110] ib_srpt: always set response for task management Greg Kroah-Hartman
2013-10-11 19:39 ` [ 087/110] rtlwifi: Align private space in rtl_priv struct Greg Kroah-Hartman
2013-10-11 19:39 ` [ 088/110] p54usb: add USB ID for Corega WLUSB2GTST USB adapter Greg Kroah-Hartman
2013-10-11 19:39 ` [ 089/110] mm: avoid reinserting isolated balloon pages into LRU lists Greg Kroah-Hartman
2013-10-11 19:39 ` [ 090/110] iscsi-target: Only perform wait_for_tasks when performing shutdown Greg Kroah-Hartman
2013-10-11 19:39 ` [ 091/110] net: Update the sysctl permissions handler to test effective uid/gid Greg Kroah-Hartman
2013-10-11 19:39 ` [ 092/110] irq: Force hardirq exits softirq processing on its own stack Greg Kroah-Hartman
2013-10-11 19:39 ` [ 093/110] Revert "drm/radeon: add missing hdmi callbacks for rv6xx" Greg Kroah-Hartman
2013-10-11 19:39 ` [ 094/110] dmaengine: imx-dma: fix lockdep issue between irqhandler and tasklet Greg Kroah-Hartman
2013-10-11 19:39 ` [ 095/110] dmaengine: imx-dma: fix callback path in tasklet Greg Kroah-Hartman
2013-10-11 19:39 ` [ 096/110] dmaengine: imx-dma: fix slow path issue in prep_dma_cyclic Greg Kroah-Hartman
2013-10-11 19:39 ` [ 097/110] ACPI / IPMI: Fix atomic context requirement of ipmi_msg_handler() Greg Kroah-Hartman
2013-10-11 19:39 ` [ 098/110] xfs: fix node forward in xfs_node_toosmall Greg Kroah-Hartman
2013-10-11 19:39 ` [ 099/110] drm/nouveau/bios/init: stub opcode 0xaa Greg Kroah-Hartman
2013-10-11 19:39 ` [ 100/110] ALSA: hda - Fix GPIO for Acer Aspire 3830TG Greg Kroah-Hartman
2013-10-11 19:39 ` [ 101/110] tile: use a more conservative __my_cpu_offset in CONFIG_PREEMPT Greg Kroah-Hartman
2013-10-11 19:39 ` [ 102/110] s390: fix system call restart after inferior call Greg Kroah-Hartman
2013-10-11 19:39 ` [ 103/110] Btrfs: change how we queue blocks for backref checking Greg Kroah-Hartman
2013-10-11 19:39 ` [ 104/110] Btrfs: skip subvol entries when checking if weve created a dir already Greg Kroah-Hartman
2013-10-11 19:39 ` [ 105/110] Btrfs: remove ourselves from the cluster list under lock Greg Kroah-Hartman
2013-10-11 19:39 ` [ 106/110] HID: roccat: add support for KonePureOptical v2 Greg Kroah-Hartman
2013-10-11 19:39 ` [ 107/110] HID: uhid: add devname module alias Greg Kroah-Hartman
2013-10-11 19:39 ` [ 108/110] HID: uhid: allocate static minor Greg Kroah-Hartman
2013-10-11 19:39 ` [ 109/110] net: qmi_wwan: add new Qualcomm devices Greg Kroah-Hartman
2013-10-11 19:39 ` [ 110/110] bcache: Fix a null ptr deref regression Greg Kroah-Hartman
2013-10-11 21:49 ` [ 000/110] 3.10.16-stable review Guenter Roeck
2013-10-11 22:08 ` 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=20131011193810.088075785@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).