Message ID | 1357842765.27446.2396.camel@edumazet-glaptop |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Thu, 10 Jan 2013 10:32:45 -0800 > [PATCH net-next] veth: fix a NULL deref in netif_carrier_off > > In commit d0e2c55e7c94 (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> Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 0f71a4f..e1da42a 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -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; }