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

From: David Ahern
Date: Sun Nov 17 2019 - 22:21:18 EST


On 11/17/19 8:16 PM, wangxiaogang (F) wrote:
>
>
> On 2019/11/16 0:59, David Ahern wrote:
>> 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.
>>
>>
>
> this problem occurs when our testers deleted the NIC and vrf in parallel.
> I will try to recurring this problem later.
>

The deletes are serial in the kernel due to the rtnl, but dev changes
are under rcu...