From patchwork Sun Dec 31 17:42:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13507291 X-Patchwork-Delegate: kuba@kernel.org Received: from mout.web.de (mout.web.de [212.227.15.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E33CB64A; Sun, 31 Dec 2023 17:42:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="MmcXPIWe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1704044552; x=1704649352; i=markus.elfring@web.de; bh=JTm3C27oEmXwy+9ZEDfsHFYIJneiCYqbeqijD6uJ37k=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=MmcXPIWeNAfwkK8WSFqMaljDRekebWDuOCgrpba98mRloXOdAUycq1EShMEeHQ7w u0qmqZXhmLWhFaxmVqrhhcxkpNIWc/kbWjpMMJqg+egVSbB9uNYvRI9HnSbWpT1KX b+IOZDQzFX1NhJA8SGi+6R2XV5/qyrT7cqFWWvURgmPPK4z1iHr3AopuTyGzWfmEF GUDYVnz7ImlKk8JaWDwYD2wH4mlhopiyVbmGUTQjXsb27keHeBRfnucLApW8PSN9o bTsVCqoViYImdseY6boXBXEIfjk5cu7ttl2mszF32n1S+taSLhKsN2oIckNeQ7Umo oklQjkWiK2AQw1THwA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.90.95]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MiuSe-1qhNpL3bTI-00ez7h; Sun, 31 Dec 2023 18:42:31 +0100 Message-ID: <477e5649-87e3-44d9-8226-010b9822e649@web.de> Date: Sun, 31 Dec 2023 18:42:30 +0100 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/4] netlink: Improve exception handling in __netlink_kernel_create() Content-Language: en-GB From: Markus Elfring To: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, Anjali Kulkarni , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Kuniyuki Iwashima , Paolo Abeni , Simon Horman Cc: LKML References: <90679f69-951c-47b3-b86f-75fd9fde3da3@web.de> In-Reply-To: <90679f69-951c-47b3-b86f-75fd9fde3da3@web.de> X-Provags-ID: V03:K1:yf4+QQ0av02wwVtpjkWq8Ru9GvaAdfgW05J6UG8fDitW5nCncT+ MuP3vsdf+ej1i1qlEV2MP6EHuj7aLxMwoossO3sDhnKcOy0VWK/SCW4CqibzRSCKs0TgWKf Q4qZzqhVt16NuVAp4Inu4u2e8zre43VfDePggFIgo1EJEo6O4KDAtIDiHdYIXTJ2U2GgiW4 ARuiz5tZGDPIuCjBLY2hQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:uL3bqpCvN40=;f5sfi6UEwM8NowNjnPPmo4TDgUO 1vSsX6wf89Mjla0suxg0Qs2mRe5zOHMqj9UVOlNJ8xthxIk1tjemi4JFjN0nNKUyF89dxQmpt J3LPYp5fCmcn/j1DuHHV00W1xsAtpu9uSrGVg+2QomIIhD6fvkcc82ZaonDz3X/ghB9QscoGz JAO7aSrnN8BJjT08rI8UbqI/lt0NZxhaN2Cahdsewz/qkYNJn1KJkMqSXmCZ0kG5160qF3kWX ZP+f4b5BI2XEaRYl1Knyy7qRhm7hup5nizx+WVsuSoontTxx/DRPbLzmJ9lfqdyf4cJR5XxmZ vJjAbwAoT1zGiEBhTZoPVmR0rEAcIEPLZiW7qKDMgUM4755/n8Ue+EpueRRfYQ4TKiI64AEZU H9RFwprov86CVEk0Qiv9pQSO60XUNLjpaHKXk9nzYxp4Ow1XKrlyq9bWfgqMrXooYKBsHrqGg ttIAQeaqIkPR+POJxwYe3VONoq5xaTi8bVcenIPhaCkhxDD9Sp/TACx3Z253AzaI+UEsRE2PI ANuEQ1qNoz+0H1H0aWjjuhdswrBTA5TkWu2wjWyiYIiWI0c471tqfTnvpQ6IuKLLV4/op0IXL ZDka2t9SgLrJy/BwKY19SoK+6LtxGe9ZfyMQUbY9kMg74KT4PdoHhsYT0xoS73mCUTpMEI48s o4YyePdnbOtyYD7GT4lIENU/QDnG5soyYuwuFdZmA6u1SfNJO2JJj4O1QIn8BSa7fCXxUiFSg LSw/YZzMdUOfsXfeFqtcQiJjMQMT7NUzUu7JdJu2rXcQmMKbowl2MjlN1dKm0Ptny1ksQ7M8+ pAUkfj0DGr1eaX9gL4H5vHMA/OTFzASJCPuZ+w8/lifC+4s9A15s1iAdIsha4CT4pkoJJh7vQ 51wRRojg1EejQ67CTcdxOOjjjj8H9fRYgRC3ttMV3Nasr/0AZtO38Z+XtP0FbzroKmh0JiF6y UbSh7A== X-Patchwork-Delegate: kuba@kernel.org From: Markus Elfring Date: Sun, 31 Dec 2023 17:26:41 +0100 The kfree() function was called in one case by the __netlink_kernel_create() function during error handling even if the passed variable contained a null pointer. This issue was detected by using the Coccinelle software. Thus use another label. Signed-off-by: Markus Elfring --- net/netlink/af_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.43.0 diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 4ed8ffd58ff3..c3f88015cacf 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -2042,7 +2042,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, listeners = kzalloc(sizeof(*listeners) + NLGRPSZ(groups), GFP_KERNEL); if (!listeners) - goto out_sock_release; + goto out_netlink_release_sock; sk->sk_data_ready = netlink_data_ready; if (cfg && cfg->input) @@ -2076,6 +2076,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, out_sock_release: kfree(listeners); +out_netlink_release_sock: netlink_kernel_release(sk); return NULL; From patchwork Sun Dec 31 17:44:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13507292 Received: from mout.web.de (mout.web.de [212.227.15.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 212468F57; Sun, 31 Dec 2023 17:44:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="ZICg/2x8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1704044654; x=1704649454; i=markus.elfring@web.de; bh=aLRR7U3/AFWimf4oVCx2OhgMuy/xKWfmXx3IC9naGIo=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=ZICg/2x8jB8G+KIct6nZM1VB7yYS8bZKI8uVBgjZDgsHINnA996adoD4Yb6O60kS f0g96Di7aDn+W/3ehNB0jrfNgrsWQTOE8+weRlUJrbbU8BeKbrrvc9HzUZLy5m2P8 WZILEv8b6f0sFodSLEhxztGhYr52mRXldwyRb27UBZYlLt9AyG5+bq8GiOBYoP/m4 U870N9NZd7T5TVgckvKpJum8Eqc4qzqfySSe6qokoQQRQPWqiKLQvBp3IKDt2/KZA PUhIwVQLrjJiDv4kKMEN8e7ZWm2LkKmig5xL5bywy2yQpnRW76SU2/Y+Tdp6ClZPj wUojxS92Rv5ST+hiaw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.90.95]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MGgJK-1rOvng17Cs-00EAuA; Sun, 31 Dec 2023 18:44:14 +0100 Message-ID: <223a61e9-f826-4f37-b514-ca6ed53b1269@web.de> Date: Sun, 31 Dec 2023 18:44:13 +0100 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: =?utf-8?q?=5BPATCH_2/4=5D_netlink=3A_Move_an_assignment_for_the_var?= =?utf-8?q?iable_=E2=80=9Csk=E2=80=9D_in_=5F=5Fnetlink=5Fkernel=5Fcreate=28?= =?utf-8?q?=29?= Content-Language: en-GB From: Markus Elfring To: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, Anjali Kulkarni , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Kuniyuki Iwashima , Paolo Abeni , Simon Horman Cc: LKML References: <90679f69-951c-47b3-b86f-75fd9fde3da3@web.de> In-Reply-To: <90679f69-951c-47b3-b86f-75fd9fde3da3@web.de> X-Provags-ID: V03:K1:ksyD/iMiLeEsohqK+0cCAC5fthmh8rU3GpZGbK03fzCSWClI94G 37s9Zn3bmBCTEv2pCWiDkyKTTAnUFupLBgaHD123O7VIh+wUSyNdMhI8snA5lb7pOIJe0+8 CqUxbtM0vaAbEPtiBLJPNs1KNBKH1fJGNBUgeGPKqOZHjZtGdoEf24MwaFrJRCHVVHc+ewh FM6JFRq1R3r+r3aTKOBwQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:3vJBw6+nSHY=;FCw8Qqfha8upD8QrqFMCGDHpOeM FSFOuMqokXOUCvUYgZJDBwafuX59T1/hLY9Ibp6QO9aoqKI1xx+OA2urVj3EsmcWwQUnhOYle hsuamEAQPRDwNJAliMPJlF9PWoXvK33c9YXHffLpMpRfSyua0Jm4Zdq7ha1s5EMvp9OHmryyL EUscDbvHLIREli8RVjqi0hyNnN3z06nyRyYTkN3IHSjW6WZhM70TewhcSiS2lxbgdKdJLx7KE JKrtAQSTfKpwAo/lid9EanpneMSuJhFxKeWdUH/kyVT3rjdgtW6lIKdcBYRY7H6udc8p9pqjP KNQRtnVrpSlMQ8puURlQHiAeaVc7VN+DICpeDs2YEYJwCseyHoGyXhgZBB7cwb9EK6Ey37Jqx BSFGFZXyC5xGpU6lyR8JB4zuKXM6wRnzfayoU3dwO7DrGpkV22Gn85S2edDsfVd2kNqcht4X/ zm9/LMdF3KNhFCzBpSGu+FW/ZWuc0lEiKxpg4USsXAeTKDDWlXnfnlpfCJJy3YX7mMrqIOV8E jQex9+H/lrvt2XXv02msanXiB5FytV/vH7CreghlX1Bmxk1eqA+2wx1IxLCh4eMAJ07H4BDNf kCzE7CIQ6fkxa4TzXhnhTD0uY2UYUTlvIuAIetCmYHWcPvycjI/+lgVTjEdIkpAxMBzORr4j/ i663RPem2oGSHsZODzXYempljTIE4B9IXFnpSYCm/bOAiLzPYVwtRd2e3M4OfQtSP7If0v4db At2Se17pX2eBoj31ID5mtd1MiNNQ7034+rPmcTXNeQqf0sKYmFpxCgEPmEmOIDk7uW2ef8ZnA M7xKK4PCxMjhSBZYjbwmhpPdaH6DHDk6RsOPj+CuPsdx8yZFuJPlh78Hkz+LewzcYbAr4tkrP Yu/mHhZXugcOtmg6aGmtukzpL+lE0SrYIp4J7KrK0o+fJ1+YTsWCkHpSy5MaNajG3oGBfrpmd W7MQUw== From: Markus Elfring Date: Sun, 31 Dec 2023 17:36:50 +0100 Move one assignment for the variable “sk” closer to the place where this pointer is used. Signed-off-by: Markus Elfring --- net/netlink/af_netlink.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.43.0 diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index c3f88015cacf..b71d9c21d15b 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -2033,8 +2033,6 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, if (__netlink_create(net, sock, cb_mutex, unit, 1) < 0) goto out_sock_release_nosk; - sk = sock->sk; - if (!cfg || cfg->groups < 32) groups = 32; else @@ -2044,6 +2042,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, if (!listeners) goto out_netlink_release_sock; + sk = sock->sk; sk->sk_data_ready = netlink_data_ready; if (cfg && cfg->input) nlk_sk(sk)->netlink_rcv = cfg->input; From patchwork Sun Dec 31 17:46:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13507293 X-Patchwork-Delegate: kuba@kernel.org Received: from mout.web.de (mout.web.de [212.227.15.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20CBB8F48; Sun, 31 Dec 2023 17:46:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="kgAISiG5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1704044770; x=1704649570; i=markus.elfring@web.de; bh=zNxLcIyTelDfgCWbRzOiNYP/OsCyug4PyGLRPHXHIgA=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=kgAISiG5TUD48eiMkvyLXJHBZaaqVgO1aqqr/bfgByJKmIxto6bfhEkQ4Jrih3eP bqYsXbC5BYj3XVyN78DyWZg9MMaJsTJ++hkaC1w2wDD3wHkZSo01HOC2kFBgkXyhf WrywTw1OhJrEtc29Z3zYyl6ximTGQ6YrJLMW+m1ANtdKggWvg+YLFHj5hK1l6P3Jd a8X4MHkZMVGt3dfsn/EV3z2/01W7xZj0x05yu4kdi7f5CWxzwTgLWTZ9boixJdO/h ovMITJwFeAlWP6FrTd5DWbJHclP571w0hXTFwKUrvfLsYHdQOSAzk6iwexJxEIqR6 QfdMFeW67zuZbhjmdQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.90.95]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MGxQV-1rOeqf0ukl-00Dtmh; Sun, 31 Dec 2023 18:46:10 +0100 Message-ID: <57779d2f-0d39-4c2e-8718-3c9242177013@web.de> Date: Sun, 31 Dec 2023 18:46:09 +0100 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/4] netlink: Delete an unnecessary variable initialisation in __netlink_kernel_create() Content-Language: en-GB From: Markus Elfring To: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, Anjali Kulkarni , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Kuniyuki Iwashima , Paolo Abeni , Simon Horman Cc: LKML References: <90679f69-951c-47b3-b86f-75fd9fde3da3@web.de> In-Reply-To: <90679f69-951c-47b3-b86f-75fd9fde3da3@web.de> X-Provags-ID: V03:K1:LYJBemVScIDnkTHCBaOU7X3PN9jEiJKMRkwsrbqrrh1trsJmQbL Xkz3LO9XKgdMqnZds9v3GlwhFnfWk3nX7DW/qzr6U29o2sZlj3RjMMo1HWeIvTNmfQfwWT2 MRIDtjEgVlSHSqWN7kOw30XZYSOvDQL05WfCj/DDW6lJ6fZ1bYtPM+XMkw7l8Z0BhRVcJoK BmojJ6Yodgb75Ixa1fRUg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:gjC212gal3M=;oZQAD3kGRYWDqKtckJnzDSnm7wh kgi/6vhcQYFeUNX+m1Rhf7I1MlYO++FJv/bbCDUWXIsLAgALPtWMJuMAWZaMl+bzebt1E/Xhn Gog+AgirnC1dOgvh1pH+gvtu3xfNxZFaAT0n8/0nCi1Db/3XWH+Oh8NdZ97hJWALa0zH5tlBW FaPN8oANtJHjTPLMzRfj12Rxxm27Ao3vuleWQ7v0/HwclwnXQz631GNvIpgrnX56G/po9a4bl TamdEFNRVr0qt+Njk3ozT7wpas56mTV9+ajJb0Y6Q7DDle2yZl+8LliatC/iUp3lt/ON52b8G YJpUWe9hcQ5ZTWHDZgqC9GcXmIqny9MYQLbuH4iNjzyHwxAEBDDv88HB7bwIsY4RcHW1dbnRl WDfzWwFfHd7/Atsz4uBOxDXFVyw/1xlIaOtEBy+uXJzKt5vKGZ08U/ltU3RA9yDftLB2EAJct SSmKxvUsa4heza1Gx80kLGbbjoRGi6ESOHFFY/vXHCJfu9MWROUFjG4/nhnjZVbdWrfUN3uLw VYar5n+aFMCvqFAcoD8d3QIEShkD2QOnDQix0uZh1Adk2BJT+5kLL70h63IzJTousjDLey6O9 F9i+Sn67qkXhggNfzKwyIhvTHkXJ25AXXmNnOHUAR4mKxbHdOQAowf6MvM3bEr0i55x7broO8 lN68vF4BTG3udAPgR5viuhWGdBid/bDBjI79ZJ+rFP2xeTXlypSG23BNIemvvP9D1SwdXBcZ/ 1arQXkSKpa2tdsWjgNYW+KcNoVtfg3vUUbkZB8EIT3vpXjoEaLqHD2NlOHi3iJsyPl8ZKcS61 jh0zuxRRF9F00/O55JNdaAzZ5pQfE7LSLGu0RcWj17m/SRxC567Ogic2IMWa8r6g9vm63AraY A+0u5UHK9vtLwV3X571b6VWN8wpB4EnbXsb99gxuAXGrN1iujKvhMqSG5L+/YM10oex4MjfcV 0eHUTQ== X-Patchwork-Delegate: kuba@kernel.org From: Markus Elfring Date: Sun, 31 Dec 2023 17:45:00 +0100 The variable “listeners” will eventually be set to an appropriate pointer a bit later. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring Acked-by: Stephen Hemminger --- net/netlink/af_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index b71d9c21d15b..cfddc9c6a376 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -2018,7 +2018,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, struct socket *sock; struct sock *sk; struct netlink_sock *nlk; - struct listeners *listeners = NULL; + struct listeners *listeners; struct mutex *cb_mutex = cfg ? cfg->cb_mutex : NULL; unsigned int groups; From patchwork Sun Dec 31 17:48:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13507294 Received: from mout.web.de (mout.web.de [212.227.15.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FB298F57; Sun, 31 Dec 2023 17:48:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="ZsebrwNL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1704044892; x=1704649692; i=markus.elfring@web.de; bh=DxIaqkFvyCP4q3o29hYuSHbxCSE+JDd8CW1vm0ANeu4=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=ZsebrwNLwowD6n33dhC0GiBXR9OauHocAJjcGlzGMjGmYSO/pTVzUOU6XyosUoMF JqfGtcFR9+Fp0NlG1IOnrvV9T6xF7kN1yz1+xhytd6hjAOoBOE+s86ybPEPB/EBSw 29fJsCkopionzu9JIQmJWsHyZN3YyTH97xY7faCFlk/ljwaiQ5n/rtnS5bEDkIVkW GCiDfTE/82OCDMuMYOOV/77hVo4haUwYIIUvBsRvJK8ZWWtj2sabkrwPusXNiY/Ge QiVcAQ/8Yh/uV528tPOgZ+Ruh70t9/Nt5duRpXGoevQbJJH3Pj7qrbebddwWrelSX OGcDcEHDIxtTf0+8Bw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.90.95]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MxHUC-1r08g81Ptg-00xmWS; Sun, 31 Dec 2023 18:48:12 +0100 Message-ID: Date: Sun, 31 Dec 2023 18:48:11 +0100 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: =?utf-8?q?=5BPATCH_4/4=5D_netlink=3A_Move_an_assignment_for_the_var?= =?utf-8?q?iable_=E2=80=9Ccb=5Fmutex=E2=80=9D_in_=5F=5Fnetlink=5Fkernel=5Fcr?= =?utf-8?q?eate=28=29?= Content-Language: en-GB From: Markus Elfring To: netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, Anjali Kulkarni , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Kuniyuki Iwashima , Paolo Abeni , Simon Horman Cc: LKML References: <90679f69-951c-47b3-b86f-75fd9fde3da3@web.de> In-Reply-To: <90679f69-951c-47b3-b86f-75fd9fde3da3@web.de> X-Provags-ID: V03:K1:CQ9qMA/8hempdUNkAURlBEHPPhumiz+JPok0x077qDtK1n4Nn4M 7e3Lq5moDaSVvvQmgPV1lD0bo/wZg2XRLt3vyiFHR5tvjWoDlmHkF2a4K+y+RLBSGuYX0NJ fsdQj9DNkVgA4UJeQdFSvXOmIUIDKGnf3qXsZ2H056HJM4IW/NMObVOU39TEsi/olm/0WDp sWUO3HS9ALwHQje3yWOOA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:04G/Mo8NypI=;ESAuPWEakwRUjaQfehxGcf2D2Vk 3begh/m05m7c7+oZ4sh68mPFNhtQV1WG3aXHBMfTiv6JHCFqLkIwgSXzkpBm1oyCduIuLH6Jt +RHlWub3yeOHJ+cnTpUgj8r6re7OlKfr8yIXsO1+LiCAfGswpSECXu4q24rItiEKrviaWiCmi rBctdCqP+1Tm7KXDuuPITAy4IAjZC8HNeFgei+mRISl0ISooRsM/Oan96iXML6L2JVPjbGicJ jJ8OZB0Ucu7qLn+fpZFk7lFLW7BVVQhACxwkt6X8vwewY0FdoNBfkTIv8l7oAfR6AWfkfwHYC 2R/Gf4fHyQ74lYM/KhjX1UTkStDhT1xx2PdBRRp9q4MPh4eJqgFkK2xoxAsdT8vvYqRwbFCM4 fGLgt3SjMhjIjRiawzhEowB9ppvNmVuilooi9Wx6dWmT/uVcM+Xq9Rdyi2MA8knPprmezd/tZ ZjLC5NN4HeRPNBHf+UNRyv50+VSu4zMLC0BA/1FP0YazhDq1bVqqdebrp/RWwS/+ZOqihCTfG rhqhxDd5Tlw1iaoab1lfRpGh+F7d/UVSOpmUn+uM02IeAyMQoo92tZnSBxqFw9LV9PsczX2nL QTuEbqxrpn1ukn3H+ezUgh28yIwAb4LPzbSPGz8HKEkQHiEQHf8ElH5aZjYIaISl8blcILsBF MFoKSztGoIszzodIQDENpVvaM4qTB8sV1cL+WfPMchmJTWCzcH/uh7DB7+kGzQ/CCWFqmjYSG qGvOdD5BvC9v8Izin4IH4gDkEAfsqBGsoYx7qOL8NvJL8RpeW4UPDHHERTaLFfnPh+u8XYZPg 4LyCEOPqQbJ0cBIdCtDAx878ohZN8Q3iCtutSUC7WeZVI8Si4B9so9a8lmJ3aBdRoZsDQYQN7 URNGLtvS9OtyAIxWXBY5s0rmEfmKB+IsEonZUoAWa5nOOtcQAlVGUF8uwnXOZIYytPsofO7Rh lnxJBJALSR7ayDmPgtuLX5qr3Ro= From: Markus Elfring 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 --- net/netlink/af_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.43.0 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;