Skip to content

Commit

Permalink
veth: fix a NULL deref in netif_carrier_off
Browse files Browse the repository at this point in the history
In commit d0e2c55 (veth: avoid a NULL deref in veth_stats_one)
we now clear the peer pointers in veth_dellink()

veth_close() must therefore make sure the peer pointer is set.

Reported-by: Tom Parkin <tom.parkin@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 10, 2013
1 parent 1f1e495 commit 2efd32e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/veth.c
Original file line number Diff line number Diff line change
@@ -206,9 +206,11 @@ static int veth_open(struct net_device *dev)
static int veth_close(struct net_device *dev)
{
struct veth_priv *priv = netdev_priv(dev);
struct net_device *peer = rtnl_dereference(priv->peer);

netif_carrier_off(dev);
netif_carrier_off(rtnl_dereference(priv->peer));
if (peer)
netif_carrier_off(peer);

return 0;
}

0 comments on commit 2efd32e

Please sign in to comment.