Skip to content

Commit 214964a

Browse files
committed
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: d3efc2a ("net: devlink: remove devlink_mutex") Reviewed-by: Jiri Pirko <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 078838f commit 214964a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/core/devlink.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,10 +1648,13 @@ static int devlink_nl_cmd_get_dumpit(struct sk_buff *msg,
16481648
continue;
16491649
}
16501650

1651+
devl_lock(devlink);
16511652
err = devlink_nl_fill(msg, devlink, DEVLINK_CMD_NEW,
16521653
NETLINK_CB(cb->skb).portid,
16531654
cb->nlh->nlmsg_seq, NLM_F_MULTI);
1655+
devl_unlock(devlink);
16541656
devlink_put(devlink);
1657+
16551658
if (err)
16561659
goto out;
16571660
idx++;

0 commit comments

Comments
 (0)