summaryrefslogtreecommitdiff
path: root/drivers/net/veth.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-01-10 08:32:45 +0000
committerDavid S. Miller <davem@davemloft.net>2013-01-10 14:11:46 -0800
commit2efd32ee1b60b0b31404ca47c1ce70e5a5d24ebc (patch)
tree53ac968a74d97fb6b02ce1bd7c860fdd4bc378a0 /drivers/net/veth.c
parent1f1e4958069c6e7ff3f8b73148d14c08d015f0bf (diff)
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/veth.c')
-rw-r--r--drivers/net/veth.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 0f71a4fe506a..e1da42aaf9de 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;
}