Re: [PATCH] vrf: Fix possible NULL pointer oops when delete nic

From: David Ahern
Date: Fri Nov 15 2019 - 11:59:53 EST


On 11/14/19 11:22 PM, wangxiaogang (F) wrote:
> diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
> index b8228f5..86c4b8c 100644
> --- a/drivers/net/vrf.c
> +++ b/drivers/net/vrf.c
> @@ -1427,6 +1427,9 @@ static int vrf_device_event(struct notifier_block *unused,
> goto out;
>
> vrf_dev = netdev_master_upper_dev_get(dev);
> + if (!vrf_dev)
> + goto out;
> +
> vrf_del_slave(vrf_dev, dev);
> }
> out:

BTW, I believe this is the wrong fix. A device can not be a VRF slave
AND not have an upper device. Something is fundamentally wrong.