]> 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:32:48 +0000 (17:32 +0100)
commit8f58c538573a0cf799e89bb287ee935adc8da2df
tree91f0227c916acc38a4974afc39302a7e9d88aaa5
parentd862b63605dfabfd17788f1c722e7375d4137c05
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