From: Pablo Neira Ayuso Date: Fri, 26 Aug 2016 11:42:17 +0000 (+0200) Subject: netfilter: nf_tables: Use nla_put_be32() to dump immediate parameters X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7073b16f3dff83df1b0794262386abb869e8d180;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git netfilter: nf_tables: Use nla_put_be32() to dump immediate parameters nft_dump_register() should only be used with registers, not with immediates. Fixes: cb1b69b0b15b ("netfilter: nf_tables: add hash expression") Fixes: 91dbc6be0a62("netfilter: nf_tables: add number generator expression") Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c index e090aeef3a78..764251d31e46 100644 --- a/net/netfilter/nft_hash.c +++ b/net/netfilter/nft_hash.c @@ -88,11 +88,11 @@ static int nft_hash_dump(struct sk_buff *skb, goto nla_put_failure; if (nft_dump_register(skb, NFTA_HASH_DREG, priv->dreg)) goto nla_put_failure; - if (nft_dump_register(skb, NFTA_HASH_LEN, priv->len)) + if (nla_put_be32(skb, NFTA_HASH_LEN, htonl(priv->len))) goto nla_put_failure; - if (nft_dump_register(skb, NFTA_HASH_MODULUS, priv->modulus)) + if (nla_put_be32(skb, NFTA_HASH_MODULUS, htonl(priv->modulus))) goto nla_put_failure; - if (nft_dump_register(skb, NFTA_HASH_SEED, priv->seed)) + if (nla_put_be32(skb, NFTA_HASH_SEED, htonl(priv->seed))) goto nla_put_failure; return 0; diff --git a/net/netfilter/nft_numgen.c b/net/netfilter/nft_numgen.c index 176e26d5bbd0..294745ecb0fc 100644 --- a/net/netfilter/nft_numgen.c +++ b/net/netfilter/nft_numgen.c @@ -68,9 +68,9 @@ static int nft_ng_dump(struct sk_buff *skb, enum nft_registers dreg, { if (nft_dump_register(skb, NFTA_NG_DREG, dreg)) goto nla_put_failure; - if (nft_dump_register(skb, NFTA_NG_UNTIL, until)) + if (nla_put_be32(skb, NFTA_NG_UNTIL, htonl(until))) goto nla_put_failure; - if (nft_dump_register(skb, NFTA_NG_TYPE, type)) + if (nla_put_be32(skb, NFTA_NG_TYPE, htonl(type))) goto nla_put_failure; return 0;