]> git.itanic.dy.fi Git - linux-stable/commit
netfilter: nf_tables: fix nft_trans type confusion
authorFlorian Westphal <fw@strlen.de>
Thu, 11 May 2023 12:15:15 +0000 (14:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:30:19 +0000 (17:30 +0100)
commit110f8f59a822713ca5b4aa590f035c99c7b4900c
tree52d2e86f054901388d9bc610d8f40ed894bb0b47
parentd2e9490b755cb21d0c303122e77ca3d2073b5075
netfilter: nf_tables: fix nft_trans type confusion

[ Upstream commit e3c361b8acd636f5fe80c02849ca175201edf10c ]

nft_trans_FOO objects all share a common nft_trans base structure, but
trailing fields depend on the real object size. Access is only safe after
trans->msg_type check.

Check for rule type first.  Found by code inspection.

Fixes: 1a94e38d254b ("netfilter: nf_tables: add NFTA_RULE_ID attribute")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nf_tables_api.c