From: Eric W. Biederman Date: Mon, 16 Sep 2013 23:52:41 +0000 (-0700) Subject: net loopback: Set loopback_dev to NULL when freed X-Git-Tag: accepted/tizen/common/20141203.182822~1423^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e05e90702b2638a39b5ae9d22740f3a1607c54a0;p=platform%2Fkernel%2Flinux-arm64.git 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" Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index fcbf680..a17d85a 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -146,6 +146,7 @@ static int loopback_dev_init(struct net_device *dev) static void loopback_dev_free(struct net_device *dev) { + dev_net(dev)->loopback_dev = NULL; free_percpu(dev->lstats); free_netdev(dev); }