mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
nfc: enforce CAP_NET_RAW for raw sockets
[ Upstream commit 3a359798b1
]
When creating a raw AF_NFC 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>
This commit is contained in:
parent
70f80cb205
commit
b6a2d6c112
1 changed files with 5 additions and 2 deletions
|
@ -1012,10 +1012,13 @@ static int llcp_sock_create(struct net *net, struct socket *sock,
|
|||
sock->type != SOCK_RAW)
|
||||
return -ESOCKTNOSUPPORT;
|
||||
|
||||
if (sock->type == SOCK_RAW)
|
||||
if (sock->type == SOCK_RAW) {
|
||||
if (!capable(CAP_NET_RAW))
|
||||
return -EPERM;
|
||||
sock->ops = &llcp_rawsock_ops;
|
||||
else
|
||||
} else {
|
||||
sock->ops = &llcp_sock_ops;
|
||||
}
|
||||
|
||||
sk = nfc_llcp_sock_alloc(sock, sock->type, GFP_ATOMIC, kern);
|
||||
if (sk == NULL)
|
||||
|
|
Loading…
Reference in a new issue