summaryrefslogtreecommitdiff
path: root/net/rose/af_rose.c
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-02-19 11:06:22 +0300
committerDavid S. Miller <davem@davemloft.net>2019-02-20 00:22:46 +0300
commit3b9c9f3b0b0293a52c0edd033d9df3a6b0e06f62 (patch)
tree537857ad40f73eb0f8449d7923008d7a267902eb /net/rose/af_rose.c
parenta968b5e9d5879f9535d6099505f9e14abcafb623 (diff)
downloadlinux-3b9c9f3b0b0293a52c0edd033d9df3a6b0e06f62.tar.xz
net: rose: add missing dev_put() on error in rose_bind
when capable check failed, dev_put should be call before return -EACCES. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rose/af_rose.c')
-rw-r--r--net/rose/af_rose.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index d00a0ef39a56..c96f63ffe31e 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;
}