Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: nf_tables: add NFTA_SET_USERDATA if not null

Kernel sends an empty NFTA_SET_USERDATA attribute with no value if
userspace adds a set with no NFTA_SET_USERDATA attribute.

Fixes: e6d8ecac9e68 ("netfilter: nf_tables: Add new attributes into nft_set to store user data.")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

+2 -1
+2 -1
net/netfilter/nf_tables_api.c
··· 3770 3770 goto nla_put_failure; 3771 3771 } 3772 3772 3773 - if (nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata)) 3773 + if (set->udata && 3774 + nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata)) 3774 3775 goto nla_put_failure; 3775 3776 3776 3777 nest = nla_nest_start_noflag(skb, NFTA_SET_DESC);