summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Nimron <orinimron123@gmail.com>2019-09-20 10:35:47 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-05 13:47:43 +0300
commit6567debe7f9c0423e18a758060cc63ee69e2e7d0 (patch)
tree01a7f5b8a8168f46fcc4cb9f55627c6c93d1248d
parent272f46fe19daa1a18c0243cc8ac150e291ea51fd (diff)
downloadlinux-6567debe7f9c0423e18a758060cc63ee69e2e7d0.tar.xz
ax25: enforce CAP_NET_RAW for raw sockets
[ Upstream commit 0614e2b73768b502fc32a75349823356d98aae2c ] When creating a raw AF_AX25 socket, CAP_NET_RAW needs to be checked first. Signed-off-by: Ori Nimron <orinimron123@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/ax25/af_ax25.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index d783d90c20f1..63fa6ea2341e 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -859,6 +859,8 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
break;
case SOCK_RAW:
+ if (!capable(CAP_NET_RAW))
+ return -EPERM;
break;
default:
return -ESOCKTNOSUPPORT;