Message ID | 5d51ac5ca591bb38cc822376e878f0b30864b916.1721784184.git.jamie.bainbridge@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net-sysfs: check device is present when showing paths | expand |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 17927832a4fbb56d3e1dfbed29c567d70ab944be..ff2a1f6ef7e18be56c2de51902519066431e47a8 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -303,7 +303,7 @@ static ssize_t dormant_show(struct device *dev, { struct net_device *netdev = to_net_dev(dev); - if (netif_running(netdev)) + if (netif_running(netdev) && netif_device_present(netdev)) return sysfs_emit(buf, fmt_dec, !!netif_dormant(netdev)); return -EINVAL;
A sysfs reader can race with a device reset or removal. This was fixed for speed_show with commit 4224cfd7fb65 ("net-sysfs: add check for netdevice being present to speed_show") so add the same check to dormant_show. Fixes: b00055aacdb1 ("[NET] core: add RFC2863 operstate") Signed-off-by: Jamie Bainbridge <jamie.bainbridge@gmail.com> --- net/core/net-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)