summaryrefslogtreecommitdiff
path: root/net/ax25/af_ax25.c
diff options
context:
space:
mode:
authorOri Nimron <orinimron123@gmail.com>2019-09-20 09:35:47 +0200
committerDavid S. Miller <davem@davemloft.net>2019-09-24 16:37:18 +0200
commit0614e2b73768b502fc32a75349823356d98aae2c (patch)
tree2495e3ef835c1784feb27d1ca4f6c6be742fe10b /net/ax25/af_ax25.c
parent6cc03e8aa36c51f3b26a0d21a3c4ce2809c842ac (diff)
ax25: enforce CAP_NET_RAW for raw sockets
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>
Diffstat (limited to 'net/ax25/af_ax25.c')
-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 ca5207767dc2..bb222b882b67 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -855,6 +855,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;