diff options
author | Xingyuan Mo <hdthky0@gmail.com> | 2023-10-09 18:36:14 +0800 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-10-12 10:28:45 +0200 |
commit | 52177bbf19e6e9398375a148d2e13ed492b40b80 (patch) | |
tree | dcfea2f1c0c2bb9b7aacf7d6c36b4259fc63303b /net | |
parent | 4c90bba60c26db7dc7df450f748e86440149786e (diff) | |
download | linux-stable-52177bbf19e6e9398375a148d2e13ed492b40b80.tar.gz linux-stable-52177bbf19e6e9398375a148d2e13ed492b40b80.tar.bz2 linux-stable-52177bbf19e6e9398375a148d2e13ed492b40b80.zip |
nf_tables: fix NULL pointer dereference in nft_inner_init()
We should check whether the NFTA_INNER_NUM netlink attribute is present
before accessing it, otherwise a null pointer deference error will occur.
Call Trace:
dump_stack_lvl+0x4f/0x90
print_report+0x3f0/0x620
kasan_report+0xcd/0x110
__asan_load4+0x84/0xa0
nft_inner_init+0x128/0x2e0
nf_tables_newrule+0x813/0x1230
nfnetlink_rcv_batch+0xec3/0x1170
nfnetlink_rcv+0x1e4/0x220
netlink_unicast+0x34e/0x4b0
netlink_sendmsg+0x45c/0x7e0
__sys_sendto+0x355/0x370
__x64_sys_sendto+0x84/0xa0
do_syscall_64+0x3f/0x90
entry_SYSCALL_64_after_hwframe+0x6e/0xd8
Fixes: 3a07327d10a0 ("netfilter: nft_inner: support for inner tunnel header matching")
Signed-off-by: Xingyuan Mo <hdthky0@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nft_inner.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/netfilter/nft_inner.c b/net/netfilter/nft_inner.c index 28e2873ba24e..928312d01eb1 100644 --- a/net/netfilter/nft_inner.c +++ b/net/netfilter/nft_inner.c @@ -298,6 +298,7 @@ static int nft_inner_init(const struct nft_ctx *ctx, int err; if (!tb[NFTA_INNER_FLAGS] || + !tb[NFTA_INNER_NUM] || !tb[NFTA_INNER_HDRSIZE] || !tb[NFTA_INNER_TYPE] || !tb[NFTA_INNER_EXPR]) |