Skip to content

Commit

Permalink
appletalk: enforce CAP_NET_RAW for raw sockets
Browse files Browse the repository at this point in the history
When creating a raw AF_APPLETALK socket, CAP_NET_RAW needs to be checked
first.

Signed-off-by: Ori Nimron <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Armondile authored and davem330 committed Sep 24, 2019
1 parent b91ee4a commit 6cc03e8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/appletalk/ddp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,11 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol,
*/
if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
goto out;

rc = -EPERM;
if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
goto out;

rc = -ENOMEM;
sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, kern);
if (!sk)
Expand Down

0 comments on commit 6cc03e8

Please sign in to comment.