Re: [PATCH net-next v3 1/3] net: ipvlan: fix potential UAF problem for phy_dev

From: Eric Dumazet
Date: Tue Mar 22 2022 - 10:04:32 EST



On 3/19/22 02:52, Ziyang Xuan wrote:
There is a known scenario can trigger UAF problem for lower
netdevice as following:


But this known scenario never happens.

So maybe you should not add it 'in the future'



Someone module puts the NETDEV_UNREGISTER event handler to a
work, and lower netdevice is accessed in the work handler. But
when the work is excuted, lower netdevice has been destroyed
because upper netdevice did not get reference to lower netdevice
correctly.

Again, whoever would like to use a work queue would also

need to hold a reference on the device.

Regardless of ipvlan being used or not.



Although it can not happen for ipvlan now because there is no
way to access phy_dev outside ipvlan. But it is necessary to
add the reference operation to phy_dev to avoid the potential
UAF problem in the future.

Signed-off-by: Ziyang Xuan <william.xuanziyang@xxxxxxxxxx>
---


Your patch makes no sense to me really.