提交 e05e9070 编写于 作者: E Eric W. Biederman 提交者: David S. Miller

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: N"Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1ef68ec4
...@@ -146,6 +146,7 @@ static int loopback_dev_init(struct net_device *dev) ...@@ -146,6 +146,7 @@ static int loopback_dev_init(struct net_device *dev)
static void loopback_dev_free(struct net_device *dev) static void loopback_dev_free(struct net_device *dev)
{ {
dev_net(dev)->loopback_dev = NULL;
free_percpu(dev->lstats); free_percpu(dev->lstats);
free_netdev(dev); free_netdev(dev);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册