]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.11.7/net-mv643xx_eth-fix-orphaned-statistics-timer-crash.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.11.7 / net-mv643xx_eth-fix-orphaned-statistics-timer-crash.patch
1 From b6b20d9c54b23ba35c5807e45ff7d9579503bffa Mon Sep 17 00:00:00 2001
2 From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
3 Date: Wed, 2 Oct 2013 12:57:21 +0200
4 Subject: net: mv643xx_eth: fix orphaned statistics timer crash
5
6 From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
7
8 [ Upstream commit f564412c935111c583b787bcc18157377b208e2e ]
9
10 The periodic statistics timer gets started at port _probe() time, but
11 is stopped on _stop() only. In a modular environment, this can cause
12 the timer to access already deallocated memory, if the module is unloaded
13 without starting the eth device. To fix this, we add the timer right
14 before the port is started, instead of at _probe() time.
15
16 Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
17 Acked-by: Jason Cooper <jason@lakedaemon.net>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 ---
21 drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
25 +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
26 @@ -2235,6 +2235,7 @@ static int mv643xx_eth_open(struct net_d
27 mp->int_mask |= INT_TX_END_0 << i;
28 }
29
30 + add_timer(&mp->mib_counters_timer);
31 port_start(mp);
32
33 wrlp(mp, INT_MASK_EXT, INT_EXT_LINK_PHY | INT_EXT_TX);
34 @@ -2914,7 +2915,6 @@ static int mv643xx_eth_probe(struct plat
35 mp->mib_counters_timer.data = (unsigned long)mp;
36 mp->mib_counters_timer.function = mib_counters_timer_wrapper;
37 mp->mib_counters_timer.expires = jiffies + 30 * HZ;
38 - add_timer(&mp->mib_counters_timer);
39
40 spin_lock_init(&mp->mib_counters_lock);
41