From: Breno Leitao <leitao@debian.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
Breno Leitao <leitao@debian.org>,
max@kutsevol.com, thepacketgeek@gmail.com, vlad.wing@gmail.com,
davej@codemonkey.org.uk
Subject: [PATCH net-next 1/4] netconsole: Ensure dynamic_netconsole_mutex is held during userdata update
Date: Wed, 13 Nov 2024 07:10:52 -0800 [thread overview]
Message-ID: <20241113-netcon_cpu-v1-1-d187bf7c0321@debian.org> (raw)
In-Reply-To: <20241113-netcon_cpu-v1-0-d187bf7c0321@debian.org>
Add a lock assertion to verify that dynamic_netconsole_mutex is held
when updating the userdata fields in the netconsole driver.
This change prevents calling update_userdata() without holding the lock,
ensuring data consistency and integrity.
The update_userdata() function is invoked only when the user changes the
configuration, so this addition does not impact performance as it is not
in the hot path.
Signed-off-by: Breno Leitao <leitao@debian.org>
---
drivers/net/netconsole.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 4ea44a2f48f7b1f9059d275f0f0edc40cc1997f0..965712d65a014c60f91bf35e48f1b112f66b8439 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -697,6 +697,8 @@ static void update_userdata(struct netconsole_target *nt)
int complete_idx = 0, child_count = 0;
struct list_head *entry;
+ lockdep_assert_held(&dynamic_netconsole_mutex);
+
/* Clear the current string in case the last userdatum was deleted */
nt->userdata_length = 0;
nt->userdata_complete[0] = 0;
--
2.43.5
next prev parent reply other threads:[~2024-11-13 15:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 15:10 [PATCH net-next 0/4] netconsole: Add support for CPU population Breno Leitao
2024-11-13 15:10 ` Breno Leitao [this message]
2024-11-13 15:10 ` [PATCH net-next 2/4] netconsole: Add option to auto-populate CPU number in userdata Breno Leitao
2024-11-19 2:33 ` Jakub Kicinski
2024-11-19 17:07 ` Breno Leitao
2024-12-04 16:52 ` Breno Leitao
2024-11-13 15:10 ` [PATCH net-next 3/4] netconsole: docs: Add documentation for CPU number auto-population Breno Leitao
2024-11-13 15:10 ` [PATCH net-next 4/4] netconsole: selftest: Validate CPU number auto-population in userdata Breno Leitao
2024-11-19 2:35 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241113-netcon_cpu-v1-1-d187bf7c0321@debian.org \
--to=leitao@debian.org \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=davej@codemonkey.org.uk \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=max@kutsevol.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=thepacketgeek@gmail.com \
--cc=vlad.wing@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox