summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/net/veth.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index e1da42aaf9de..07a4af0aa3dc 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -426,12 +426,13 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
* not being freed before one RCU grace period.
*/
RCU_INIT_POINTER(priv->peer, NULL);
-
- priv = netdev_priv(peer);
- RCU_INIT_POINTER(priv->peer, NULL);
-
unregister_netdevice_queue(dev, head);
- unregister_netdevice_queue(peer, head);
+
+ if (peer) {
+ priv = netdev_priv(peer);
+ RCU_INIT_POINTER(priv->peer, NULL);
+ unregister_netdevice_queue(peer, head);
+ }
}
static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = {