]> www.infradead.org Git - users/hch/configfs.git/commit
phonet: Handle error of rtnl_register_module().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Tue, 8 Oct 2024 18:47:37 +0000 (11:47 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 10 Oct 2024 13:39:36 +0000 (15:39 +0200)
commitb5e837c86041bef60f36cf9f20a641a30764379a
treee4dce5ab51ea4be31ef0c8dc6687634bcb940197
parent5be2062e3080e3ff6707816caa445ec0c6eaacf7
phonet: Handle error of rtnl_register_module().

Before commit addf9b90de22 ("net: rtnetlink: use rcu to free rtnl
message handlers"), once the first rtnl_register_module() allocated
rtnl_msg_handlers[PF_PHONET], the following calls never failed.

However, after the commit, rtnl_register_module() could fail silently
to allocate rtnl_msg_handlers[PF_PHONET][msgtype] and requires error
handling for each call.

Handling the error allows users to view a module as an all-or-nothing
thing in terms of the rtnetlink functionality.  This prevents syzkaller
from reporting spurious errors from its tests, where OOM often occurs
and module is automatically loaded.

Let's use rtnl_register_many() to handle the errors easily.

Fixes: addf9b90de22 ("net: rtnetlink: use rcu to free rtnl message handlers")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Acked-by: Rémi Denis-Courmont <courmisch@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/phonet/pn_netlink.c