Allow layer 4 header checksum updates if the layer 3 header was modified. net/netfilter/nft_payload.c:261:15: note: 'tsum' was declared here __wsum fsum, tsum; ^ In file included from include/linux/skbuff.h:31:0, from include/linux/if_ether.h:23, from include/uapi/linux/ethtool.h:18, from include/linux/ethtool.h:17, from include/linux/netdevice.h:42, from include/linux/if_vlan.h:15, from net/netfilter/nft_payload.c:13: include/net/checksum.h:71:9: warning: 'fsum' may be used uninitialized in this function [-Wmaybe-uninitialized] return csum_add(csum, ~addend); ^ net/netfilter/nft_payload.c:261:9: note: 'fsum' was declared here __wsum fsum, tsum; Fixes: 556c291b3a1b ("netfilter: nft_payload: layer 4 checksum adjustment for pseudoheader fields") Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> --- net/netfilter/nft_payload.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c index 30d296340f9a..fe0fe2d3e73b 100644 --- a/net/netfilter/nft_payload.c +++ b/net/netfilter/nft_payload.c @@ -257,6 +257,7 @@ static void nft_payload_set_eval(const struct nft_expr *expr, const struct nft_payload_set *priv = nft_expr_priv(expr); struct sk_buff *skb = pkt->skb; const u32 *src = ®s->data[priv->sreg]; + bool csum_mangled = false; int offset, csum_offset; __wsum fsum, tsum; __sum16 sum; @@ -295,9 +296,11 @@ static void nft_payload_set_eval(const struct nft_expr *expr, if (!skb_make_writable(skb, csum_offset + sizeof(sum)) || skb_store_bits(skb, csum_offset, &sum, sizeof(sum)) < 0) goto err; + + csum_mangled = true; } - if (priv->csum_flags && + if (priv->csum_flags && csum_mangled && nft_payload_l4csum_update(pkt, skb, fsum, tsum) < 0) goto err; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html