From: Greg Kroah-Hartman Date: Wed, 1 Aug 2012 22:49:27 +0000 (-0700) Subject: 3.4-stable patches X-Git-Tag: v3.5.1~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0ab67482b94913dbeb76ee37a2378d777ac20825;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: tg3-fix-race-condition-in-tg3_get_stats64.patch --- diff --git a/queue-3.4/series b/queue-3.4/series index 07e4dbddf39..5dba81e26b8 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -53,3 +53,4 @@ spi-pl022-disable-port-when-unused.patch qeth-repair-crash-in-qeth_l3_vlan_rx_kill_vid.patch tg3-add-device-id-of-apple-thunderbolt-ethernet-device.patch tg3-fix-read-dma-workaround-for-5719-a0.patch +tg3-fix-race-condition-in-tg3_get_stats64.patch diff --git a/queue-3.4/tg3-fix-race-condition-in-tg3_get_stats64.patch b/queue-3.4/tg3-fix-race-condition-in-tg3_get_stats64.patch new file mode 100644 index 00000000000..c3176ef9f05 --- /dev/null +++ b/queue-3.4/tg3-fix-race-condition-in-tg3_get_stats64.patch @@ -0,0 +1,36 @@ +From 0f566b208b41918053b2e67399673aaec02dde5d Mon Sep 17 00:00:00 2001 +From: Michael Chan +Date: Sun, 29 Jul 2012 19:15:44 +0000 +Subject: tg3: Fix race condition in tg3_get_stats64() + +From: Michael Chan + +commit 0f566b208b41918053b2e67399673aaec02dde5d upstream. + +Spinlock should be taken before checking for tp->hw_stats. + +Signed-off-by: Michael Chan +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/broadcom/tg3.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/broadcom/tg3.c ++++ b/drivers/net/ethernet/broadcom/tg3.c +@@ -12255,10 +12255,12 @@ static struct rtnl_link_stats64 *tg3_get + { + struct tg3 *tp = netdev_priv(dev); + +- if (!tp->hw_stats) ++ spin_lock_bh(&tp->lock); ++ if (!tp->hw_stats) { ++ spin_unlock_bh(&tp->lock); + return &tp->net_stats_prev; ++ } + +- spin_lock_bh(&tp->lock); + tg3_get_nstats(tp, stats); + spin_unlock_bh(&tp->lock); +