]> git.baikalelectronics.ru Git - kernel.git/commit
net: macvlan: fix potential UAF problem for lowerdev
authorZiyang Xuan <william.xuanziyang@huawei.com>
Fri, 11 Mar 2022 09:03:26 +0000 (17:03 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Mar 2022 10:06:53 +0000 (10:06 +0000)
commit53e96d05e45a2e507551b48ccc18ac82872bf9df
treee71af94165f3d430a0b71368c1a7cfebd445b5cf
parentb29d3802e30ec4979434c26152fe899ec503c048
net: macvlan: fix potential UAF problem for lowerdev

Add the reference operation to lowerdev of macvlan to avoid
the potential UAF problem under the following known scenario:

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

That likes as the scenario occurred by
commit 52f553199741 ("net: vlan: fix a UAF in vlan_dev_real_dev()").

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macvlan.c