aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2013-09-16 19:52:41 -0400
committerDavid S. Miller <davem@davemloft.net>2013-09-17 19:05:13 -0400
commite05e90702b2638a39b5ae9d22740f3a1607c54a0 (patch)
tree7d323d08d7c03f1412786683ef1e8252c83e8031
parent1ef68ec462571955f2a667ddf1ffe279848709d7 (diff)
net loopback: Set loopback_dev to NULL when freed
It has recently turned up that we have a number of long standing bugs in the network stack cleanup code with use of the loopback device after it has been freed that have not turned up because in most cases the storage allocated to the loopback device is not reused, when those accesses happen. Set looback_dev to NULL to trigger oopses instead of silent data corrupt when we hit this class of bug. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/loopback.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index fcbf680c3e62..a17d85a331f1 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -146,6 +146,7 @@ static int loopback_dev_init(struct net_device *dev)
146 146
147static void loopback_dev_free(struct net_device *dev) 147static void loopback_dev_free(struct net_device *dev)
148{ 148{
149 dev_net(dev)->loopback_dev = NULL;
149 free_percpu(dev->lstats); 150 free_percpu(dev->lstats);
150 free_netdev(dev); 151 free_netdev(dev);
151} 152}