From: Stephen Hemminger Date: Thu, 26 Feb 2009 06:49:24 +0000 (+0000) Subject: net: Avoid race between network down and sysfs X-Git-Tag: MMI-PSA29.97-13-9~29256^2~72 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5a5990d3090b03745a9548a6f5edef02095675cf;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git net: Avoid race between network down and sysfs Signed-off-by: Stephen Hemminger Acked-by: "Eric W. Biederman" Signed-off-by: David S. Miller --- diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 6ac29a46e23e..484f58750eba 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -77,7 +77,9 @@ static ssize_t netdev_store(struct device *dev, struct device_attribute *attr, if (endp == buf) goto err; - rtnl_lock(); + if (!rtnl_trylock()) + return -ERESTARTSYS; + if (dev_isalive(net)) { if ((ret = (*set)(net, new)) == 0) ret = len;