Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1218054 > unrolled thread

[PATCH] net: wan: sbni: fix device usage count

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2015-09-03 08:10 +0200
Last post2015-09-06 02:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] net: wan: sbni: fix device usage count Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-03 08:10 +0200
    Re: [PATCH] net: wan: sbni: fix device usage count David Miller <davem@davemloft.net> - 2015-09-06 02:40 +0200

#1218054 — [PATCH] net: wan: sbni: fix device usage count

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2015-09-03 08:10 +0200
Subject[PATCH] net: wan: sbni: fix device usage count
Message-ID<q4vSF-3u0-9@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1219663

FromDavid Miller <davem@davemloft.net>
Date2015-09-06 02:40 +0200
Message-ID<q5w9Y-862-11@gated-at.bofh.it>
In reply to#1218054
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: Thu,  3 Sep 2015 11:30:30 +0530

> 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>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web