]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 17:23:12 +0000 (18:23 +0100)
commita01e60a1ec6bef9be471fb7182a33c6d6f124e93
tree882081ec6becace2d89952e079f58865ab8d6f62
parent34aeb4da20f93ac80a6291a2dbe7b9c6460e9b26
rtnetlink: make sure to refresh master_dev/m_ops in __rtnl_newlink()

commit c6f6f2444bdbe0079e41914a35081530d0409963 upstream.

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: ba7d49b1f0f8 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/rtnetlink.c