Commit 2efd32ee authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

veth: fix a NULL deref in netif_carrier_off

In commit d0e2c55e (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: default avatarTom Parkin <tom.parkin@gmail.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1f1e4958
...@@ -206,9 +206,11 @@ static int veth_open(struct net_device *dev) ...@@ -206,9 +206,11 @@ static int veth_open(struct net_device *dev)
static int veth_close(struct net_device *dev) static int veth_close(struct net_device *dev)
{ {
struct veth_priv *priv = netdev_priv(dev); struct veth_priv *priv = netdev_priv(dev);
struct net_device *peer = rtnl_dereference(priv->peer);
netif_carrier_off(dev); netif_carrier_off(dev);
netif_carrier_off(rtnl_dereference(priv->peer)); if (peer)
netif_carrier_off(peer);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment