lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7DDD1B29-F8DA-4F59-9B0A-EC108D61E54E@remlab.net>
Date: Fri, 04 Oct 2024 16:12:52 +0900
From: Rémi Denis-Courmont <remi@...lab.net>
To: Kuniyuki Iwashima <kuniyu@...zon.com>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
CC: Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org,
 Remi Denis-Courmont <courmisch@...il.com>, Florian Westphal <fw@...len.de>
Subject: Re: [PATCH v1 net 6/6] phonet: Handle error of rtnl_register_module().



Le 4 octobre 2024 05:57:25 GMT+09:00, Kuniyuki Iwashima <kuniyu@...zon.com> a écrit :
>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 to allocate
>rtnl_msg_handlers[PF_PHONET][msgtype] and requires error handling for
>each call.
>
>Let's use rtnl_register_module_many() to handle the errors easily.
>
>Fixes: addf9b90de22 ("net: rtnetlink: use rcu to free rtnl message handlers")
>Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>

Acked-by: Rémi Denis-Courmont <courmisch@...il.com>

>---
>Cc: Remi Denis-Courmont <courmisch@...il.com>
>Cc: Florian Westphal <fw@...len.de>
>---
> net/phonet/pn_netlink.c | 27 ++++++++++-----------------
> 1 file changed, 10 insertions(+), 17 deletions(-)
>
>diff --git a/net/phonet/pn_netlink.c b/net/phonet/pn_netlink.c
>index 7008d402499d..d39e6983926b 100644
>--- a/net/phonet/pn_netlink.c
>+++ b/net/phonet/pn_netlink.c
>@@ -285,23 +285,16 @@ static int route_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
> 	return err;
> }
> 
>+static struct rtnl_msg_handler phonet_rtnl_msg_handlers[] __initdata_or_module = {
>+	{PF_PHONET, RTM_NEWADDR, addr_doit, NULL, 0},
>+	{PF_PHONET, RTM_DELADDR, addr_doit, NULL, 0},
>+	{PF_PHONET, RTM_GETADDR, NULL, getaddr_dumpit, 0},
>+	{PF_PHONET, RTM_NEWROUTE, route_doit, NULL, 0},
>+	{PF_PHONET, RTM_DELROUTE, route_doit, NULL, 0},
>+	{PF_PHONET, RTM_GETROUTE, NULL, route_dumpit, RTNL_FLAG_DUMP_UNLOCKED},
>+};
>+
> int __init phonet_netlink_register(void)
> {
>-	int err = rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_NEWADDR,
>-				       addr_doit, NULL, 0);
>-	if (err)
>-		return err;
>-
>-	/* Further rtnl_register_module() cannot fail */
>-	rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_DELADDR,
>-			     addr_doit, NULL, 0);
>-	rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_GETADDR,
>-			     NULL, getaddr_dumpit, 0);
>-	rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_NEWROUTE,
>-			     route_doit, NULL, 0);
>-	rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_DELROUTE,
>-			     route_doit, NULL, 0);
>-	rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_GETROUTE,
>-			     NULL, route_dumpit, RTNL_FLAG_DUMP_UNLOCKED);
>-	return 0;
>+	return rtnl_register_module_many(phonet_rtnl_msg_handlers);
> }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ