netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: wan: sbni: fix device usage count
@ 2015-09-03  6:00 Sudip Mukherjee
  2015-09-06  0:33 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2015-09-03  6:00 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel, netdev, Sudip Mukherjee

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 <sudip@vectorindia.org>
---
 drivers/net/wan/sbni.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 758c4ba..8fef8d8 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;
 		}
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-06  0:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-03  6:00 [PATCH] net: wan: sbni: fix device usage count Sudip Mukherjee
2015-09-06  0:33 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).