diff options
author | Jakub Kicinski <kuba@kernel.org> | 2022-12-16 05:41:22 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-12-17 06:16:28 +0100 |
commit | 214964a13ab56a9757d146b79b468a7ca190fbfb (patch) | |
tree | 6f6e58e776bc60eb33ffb20d954608589b23e2fe /net | |
parent | net: ethernet: ti: am65-cpsw: fix CONFIG_PM #ifdef (diff) | |
download | linux-214964a13ab56a9757d146b79b468a7ca190fbfb.tar.xz linux-214964a13ab56a9757d146b79b468a7ca190fbfb.zip |
devlink: protect devlink dump by the instance lock
Take the instance lock around devlink_nl_fill() when dumping,
doit takes it already.
We are only dumping basic info so in the worst case we were risking
data races around the reload statistics. Until the big devlink mutex
was removed all relevant code was protected by it, so the missing
instance lock was not exposed.
Fixes: d3efc2a6a6d8 ("net: devlink: remove devlink_mutex")
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20221216044122.1863550-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/devlink.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c index d2df30829083..032d6d0a5ce6 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -1648,10 +1648,13 @@ static int devlink_nl_cmd_get_dumpit(struct sk_buff *msg, continue; } + devl_lock(devlink); err = devlink_nl_fill(msg, devlink, DEVLINK_CMD_NEW, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, NLM_F_MULTI); + devl_unlock(devlink); devlink_put(devlink); + if (err) goto out; idx++; |