mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
bpf: devmap: fix wrong interface selection in notifier_call
[ Upstream commitf592f80483] The dev_map_notification() removes interface in devmap if unregistering interface's ifindex is same. But only checking ifindex is not enough because other netns can have same ifindex. so that wrong interface selection could occurred. Hence netdev pointer comparison code is added. v2: compare netdev pointer instead of using net_eq() (Daniel Borkmann) v1: Initial patch Fixes:2ddf71e23c("net: add notifier hooks for devmap bpf map") Signed-off-by: Taehee Yoo <ap420073@gmail.com> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
7b557dbdc5
commit
8044e741ee
@@ -520,8 +520,7 @@ static int dev_map_notification(struct notifier_block *notifier,
|
||||
struct bpf_dtab_netdev *dev, *odev;
|
||||
|
||||
dev = READ_ONCE(dtab->netdev_map[i]);
|
||||
if (!dev ||
|
||||
dev->dev->ifindex != netdev->ifindex)
|
||||
if (!dev || netdev != dev->dev)
|
||||
continue;
|
||||
odev = cmpxchg(&dtab->netdev_map[i], dev, NULL);
|
||||
if (dev == odev)
|
||||
|
||||
Reference in New Issue
Block a user