From: Ahmed S. Darwish Date: Wed, 3 Jun 2020 14:49:47 +0000 (+0200) Subject: net: mdiobus: Disable preemption upon u64_stats update X-Git-Tag: v5.7.6~383 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=aeadf66a5db6de978dc94f99b8a10c0c34f05a48;p=users%2Fdwmw2%2Flinux.git net: mdiobus: Disable preemption upon u64_stats update [ Upstream commit c7e261d81783387a0502878cd229327e7c54322e ] The u64_stats mechanism uses sequence counters to protect against 64-bit values tearing on 32-bit architectures. Updating u64_stats is thus a sequence counter write side critical section where preemption must be disabled. For mdiobus_stats_acct(), disable preemption upon the u64_stats update. It is called from process context through mdiobus_read() and mdiobus_write(). Reported-by: kernel test robot Signed-off-by: Ahmed S. Darwish Reviewed-by: Sebastian Andrzej Siewior Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 7a4eb3f2cb743..a1a4dee2a033a 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -757,6 +757,7 @@ EXPORT_SYMBOL(mdiobus_scan); static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) { + preempt_disable(); u64_stats_update_begin(&stats->syncp); u64_stats_inc(&stats->transfers); @@ -771,6 +772,7 @@ static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) u64_stats_inc(&stats->writes); out: u64_stats_update_end(&stats->syncp); + preempt_enable(); } /**