[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d250255b-fd88-4ea9-aa08-bc8d911143af@web.de>
Date: Sun, 31 Dec 2023 18:48:11 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: netdev@...r.kernel.org, kernel-janitors@...r.kernel.org,
Anjali Kulkarni <anjali.k.kulkarni@...cle.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Kuniyuki Iwashima <kuniyu@...zon.com>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 4/4] netlink: Move an assignment for the variable “cb_mutex” in __netlink_kernel_create()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 31 Dec 2023 18:16:26 +0100
Move one assignment for the variable “cb_mutex” closer to the place
where this pointer is used.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
net/netlink/af_netlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index cfddc9c6a376..12a0b6f8be19 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2019,7 +2019,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module,
struct sock *sk;
struct netlink_sock *nlk;
struct listeners *listeners;
- struct mutex *cb_mutex = cfg ? cfg->cb_mutex : NULL;
+ struct mutex *cb_mutex; /* Serialize data processing with callbacks */
unsigned int groups;
BUG_ON(!nl_table);
@@ -2030,6 +2030,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module,
if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock))
return NULL;
+ cb_mutex = (cfg ? cfg->cb_mutex : NULL);
if (__netlink_create(net, sock, cb_mutex, unit, 1) < 0)
goto out_sock_release_nosk;
--
2.43.0
Powered by blists - more mailing lists