]> git.itanic.dy.fi Git - linux-stable/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)
commit7fbf6795d127a3b1bb39b0e42579904cf6db1624
treed0cb98a9fa64a98280eeea6e5c9456ae29900f63
parentc4416f5c2eb3ed48dfba265e628a6e52da962f03
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: 1e1caa9735f90 ("ocelot: Clean up stats update deferred work")
Fixes: a556c76adc052 ("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