]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, unix: Check socket type in unix_bpf_update_proto()
authorCong Wang <cong.wang@bytedance.com>
Sat, 31 Jul 2021 19:50:38 +0000 (12:50 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 3 Aug 2021 10:52:53 +0000 (12:52 +0200)
commitfb1b5d225c6cf0efc9bd04ec5059b941354c587f
tree5f089471eced90615aa2137b3532089934e9f7d9
parentae1b0e7cf6d01c4f49fe60fa6359a854d23eb266
bpf, unix: Check socket type in unix_bpf_update_proto()

As of now, only AF_UNIX datagram socket supports sockmap. But
unix_proto is shared for all kinds of AF_UNIX sockets, so we
have to check the socket type in unix_bpf_update_proto() to
explicitly reject other types, otherwise they could be added
into sockmap, too.

Fixes: 94142ecfb97d ("af_unix: Implement ->psock_update_sk_prot()")
Reported-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/20210731195038.8084-1-xiyou.wangcong@gmail.com
net/unix/unix_bpf.c