From: Niels Dossche <niels.dossche@ugent.be>
To: Jiri Pirko <jiri@nvidia.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] devlink: use devlink lock on DEVLINK_CMD_PORT_SPLIT
Date: Mon, 21 Feb 2022 14:33:25 +0100 [thread overview]
Message-ID: <18b57f7b-6aa6-e87f-e187-feead42fc90a@ugent.be> (raw)
devlink_nl_cmd_port_split_doit is executed without taking the devlink
instance lock. This function calls to devlink_port_get_from_info, which
calls devlink_port_get_from_attrs, which calls
devlink_port_get_by_index, which accesses devlink->port_list without the
instance lock taken, while in other places devlink->port_list access
always happens with the instance lock taken. The documentation in the
struct also say that the devlink lock protects the port_list.
The flag for no locking was added after refactoring the code to no
longer use a global lock.
Fixes: 2406e7e546b2 ("devlink: Add per devlink instance lock")
Signed-off-by: Niels Dossche <niels.dossche@ugent.be>
---
net/core/devlink.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index fcd9f6d85cf1..563becaa03a6 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -8645,7 +8645,6 @@ static const struct genl_small_ops devlink_nl_ops[] = {
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = devlink_nl_cmd_port_split_doit,
.flags = GENL_ADMIN_PERM,
- .internal_flags = DEVLINK_NL_FLAG_NO_LOCK,
},
{
.cmd = DEVLINK_CMD_PORT_UNSPLIT,
--
2.35.1
next reply other threads:[~2022-02-21 13:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 13:33 Niels Dossche [this message]
2022-02-22 4:54 ` 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=18b57f7b-6aa6-e87f-e187-feead42fc90a@ugent.be \
--to=niels.dossche@ugent.be \
--cc=jiri@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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
all inboxes | Powered by JetHome®