Skip to content

Commit e05e907

Browse files
ebiedermdavem330
authored andcommitted
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>
1 parent 1ef68ec commit e05e907

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎drivers/net/loopback.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ static int loopback_dev_init(struct net_device *dev)
146146

147147
static void loopback_dev_free(struct net_device *dev)
148148
{
149+
dev_net(dev)->loopback_dev = NULL;
149150
free_percpu(dev->lstats);
150151
free_netdev(dev);
151152
}

0 commit comments

Comments
 (0)