netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: rose: add missing dev_put() on error in rose_bind
@ 2019-02-19  8:06 YueHaibing
  2019-02-19 21:23 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2019-02-19  8:06 UTC (permalink / raw)
  To: ralf, davem; +Cc: linux-kernel, netdev, linux-hams, YueHaibing

when capable check failed, dev_put should
be call before return -EACCES.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 net/rose/af_rose.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index d00a0ef..c96f63f 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -689,8 +689,10 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 		rose->source_call = user->call;
 		ax25_uid_put(user);
 	} else {
-		if (ax25_uid_policy && !capable(CAP_NET_BIND_SERVICE))
+		if (ax25_uid_policy && !capable(CAP_NET_BIND_SERVICE)) {
+			dev_put(dev);
 			return -EACCES;
+		}
 		rose->source_call   = *source;
 	}
 
-- 
2.7.0



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

* Re: [PATCH net-next] net: rose: add missing dev_put() on error in rose_bind
  2019-02-19  8:06 [PATCH net-next] net: rose: add missing dev_put() on error in rose_bind YueHaibing
@ 2019-02-19 21:23 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-02-19 21:23 UTC (permalink / raw)
  To: yuehaibing; +Cc: ralf, linux-kernel, netdev, linux-hams

From: YueHaibing <yuehaibing@huawei.com>
Date: Tue, 19 Feb 2019 16:06:22 +0800

> when capable check failed, dev_put should
> be call before return -EACCES.
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Applied.

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

end of thread, other threads:[~2019-02-19 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19  8:06 [PATCH net-next] net: rose: add missing dev_put() on error in rose_bind YueHaibing
2019-02-19 21:23 ` 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).