]> git.baikalelectronics.ru Git - kernel.git/commit
rtnetlink: make sure to refresh master_dev/m_ops in __rtnl_newlink()
authorEric Dumazet <edumazet@google.com>
Tue, 1 Feb 2022 01:21:06 +0000 (17:21 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 2 Feb 2022 04:19:00 +0000 (20:19 -0800)
commit5f008ed866e0e4bc36c5c6ec4aa6558af224b87b
treea092807eddace8b3d89c808d4f65071057bfb8e1
parente1a64649ca6466c7b5c393da6de320b330b306c0
rtnetlink: make sure to refresh master_dev/m_ops in __rtnl_newlink()

While looking at one unrelated syzbot bug, I found the replay logic
in __rtnl_newlink() to potentially trigger use-after-free.

It is better to clear master_dev and m_ops inside the loop,
in case we have to replay it.

Fixes: 5255a36979fa ("rtnetlink: provide api for getting and setting slave info")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20220201012106.216495-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/rtnetlink.c