]> 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:36:52 +0000 (17:36 +0100)
commitb0cc763806c045047cd7e6487a7771eb78aedfa8
tree2226bab2b539aa1325bab0745c4904f511166300
parentaddaba68018b1a98172bd97d349eaa6386a66043
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