Skip to content

Commit

Permalink
net loopback: Set loopback_dev to NULL when freed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Sep 17, 2013
1 parent 1ef68ec commit e05e907
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e05e907

Please sign in to comment.