net/nfc/rawsock.c: add CAP_NET_RAW check.
Subsystems (3)
PATCH 1/1 net/nfc/rawsock.c: add CAP_NET_RAW check.
When creating a raw AF_NFC socket, CAP_NET_RAW needs to be checked first.
Signed-off-by Qingyu Li <[email protected]>
--- net/nfc/rawsock.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/nfc/rawsock.c +5 -2
@@ -332,10 +332,13 @@ static int rawsock_create(struct net *net, struct socket *sock,if ((sock->type !=SOCK_SEQPACKET ) && (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 = &rawsock_raw_ops; -else + }else { sock->ops = &rawsock_ops; + } sk =sk_alloc (net,PF_NFC ,GFP_ATOMIC , nfc_proto->proto, kern);if (!sk)
Signature · 1 line
2.17.1
David Miller
maintainerFrom: Qingyu Li <[email protected]>
Date: Mon, 10 Aug 2020 09:51:00 +0800
Quoted 3 lines
When creating a raw
AF_NFCsocket,CAP_NET_RAWneeds to be checked first.Signed-off-by Qingyu Li <[email protected]>
Applied and queued up for -stable, thank you.