From: Sudip Mukherjee Date: Thu, 3 Sep 2015 06:00:30 +0000 (+0530) Subject: net: wan: sbni: fix device usage count X-Git-Tag: firefly_0821_release~176^2~1091^2~48 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bd516bd1feeb3890502178a74228ec05271f2b6d;p=firefly-linux-kernel-4.4.55.git net: wan: sbni: fix device usage count dev_get_by_name() will increment the usage count if the matching device is found. But we were not decrementing the count if we have got the device and the device is non-active. Signed-off-by: Sudip Mukherjee Signed-off-by: David S. Miller --- diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 758c4ba1e97c..8fef8d83436d 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -1358,6 +1358,8 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd ) if( !slave_dev || !(slave_dev->flags & IFF_UP) ) { netdev_err(dev, "trying to enslave non-active device %s\n", slave_name); + if (slave_dev) + dev_put(slave_dev); return -EPERM; }