From: Ori Nimron Date: Fri, 20 Sep 2019 07:35:47 +0000 (+0200) Subject: ax25: enforce CAP_NET_RAW for raw sockets X-Git-Tag: v4.9.195~94 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73b8d26c842a5a3be34a321beab1f97939d9794b;p=platform%2Fkernel%2Flinux-amlogic.git 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 2772f6a..de55a3f 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;