]> www.infradead.org Git - users/dwmw2/linux.git/commit
netfilter: nft_socket: only do sk lookups when indev is available
authorFlorian Westphal <fw@strlen.de>
Thu, 28 Apr 2022 07:39:21 +0000 (09:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 07:05:08 +0000 (09:05 +0200)
commit842a9bbbeff14aa38e806500f0fe729f74e26e9b
treed258cbe92db924a29be844940a5447d2f79bf1ae
parent7346e54dbf5bff11255b9c5476513ff3016608b6
netfilter: nft_socket: only do sk lookups when indev is available

commit 743b83f15d4069ea57c3e40996bf4a1077e0cdc1 upstream.

Check if the incoming interface is available and NFT_BREAK
in case neither skb->sk nor input device are set.

Because nf_sk_lookup_slow*() assume packet headers are in the
'in' direction, use in postrouting is not going to yield a meaningful
result.  Same is true for the forward chain, so restrict the use
to prerouting, input and output.

Use in output work if a socket is already attached to the skb.

Fixes: 554ced0a6e29 ("netfilter: nf_tables: add support for native socket matching")
Reported-and-tested-by: Topi Miettinen <toiwoton@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nft_socket.c