]> git.baikalelectronics.ru Git - kernel.git/commit
net: mscc: ocelot: fix mutex lock error during ethtool stats read
authorColin Foster <colin.foster@in-advantage.com>
Thu, 10 Feb 2022 15:04:51 +0000 (07:04 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 10 Feb 2022 19:44:41 +0000 (11:44 -0800)
commite72e81ac16078280b5f815bfddaa05f37e9db2ef
treed0cb98a9fa64a98280eeea6e5c9456ae29900f63
parent178b6e8da07eb0f32658dee463f615b787522328
net: mscc: ocelot: fix mutex lock error during ethtool stats read

An ongoing workqueue populates the stats buffer. At the same time, a user
might query the statistics. While writing to the buffer is mutex-locked,
reading from the buffer wasn't. This could lead to buggy reads by ethtool.

This patch fixes the former blamed commit, but the bug was introduced in
the latter.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Fixes: e68a7b956f6dd ("ocelot: Clean up stats update deferred work")
Fixes: 1bed22a67906a ("net: mscc: Add initial Ocelot switch support")
Reported-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/all/20220210150451.416845-2-colin.foster@in-advantage.com/
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mscc/ocelot.c