nftables: Avoid duplicate call to nft_data_uninit() for same key
Subsystems (2)
PATCH 1/1 nftables: Avoid duplicate call to nft_data_uninit() for same key
nft_del_setelem() currently calls nft_data_uninit() twice on the same key. Once to release the key which is guaranteed to be NFT_DATA_VALUE and a second time in the error path to which it falls through.
The second call has been harmless so far though because the type passed is always NFT_DATA_VALUE which is currently a no-op.
--- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_tables_api.c +1 -0
@@ -3218,6 +3218,7 @@ static int nft_del_setelem(struct nft_ctx *ctx, struct nft_set *set,if (set->flags &NFT_SET_MAP )nft_data_uninit (&elem.data, set->dtype); +return 0 ; err2:nft_data_uninit (&elem.key, desc.type); err1:
Signature · 1 line
1.9.3
Quoted 6 lines · Thomas Graf
nft_del_setelem()currently callsnft_data_uninit()twice on the same key. Once to release the key which is guaranteed to beNFT_DATA_VALUEand a second time in the error path to which it falls through.The second call has been harmless so far though because the type passed is always
NFT_DATA_VALUEwhich is currently a no-op.
Applied, thanks Thomas.
BTW, this bug seems to be there since the very beginning:
http://lxr.free-electrons.com/source/net/netfilter/nf_tables_api.c?v=3.13#L2735