mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 21:03:32 +00:00
devlink: protect devlink dump by the instance lock
[ Upstream commit214964a13a
] 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:d3efc2a6a6
("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b93528b638
commit
64a0245921
1 changed files with 3 additions and 0 deletions
|
@ -1498,10 +1498,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++;
|
||||
|
|
Loading…
Reference in a new issue