stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.19.y] netfilter: nft_payload: do not update layer 4 checksum when mangling fragments
@ 2022-01-28 11:38 Florian Westphal
  2022-01-28 11:43 ` Pablo Neira Ayuso
  2022-01-29 11:50 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Westphal @ 2022-01-28 11:38 UTC (permalink / raw)
  To: stable
  Cc: netfilter-devel, Pablo Neira Ayuso, Steffen Weinreich,
	Florian Westphal

From: Pablo Neira Ayuso <pablo@netfilter.org>

commit 4e1860a3863707e8177329c006d10f9e37e097a8 upstream.

IP fragments do not come with the transport header, hence skip bogus
layer 4 checksum updates.

Fixes: 1814096980bb ("netfilter: nft_payload: layer 4 checksum adjustment for pseudoheader fields")
Reported-and-tested-by: Steffen Weinreich <steve@weinreich.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 This is already in the 5.y branches but 4.19 needs a minor
 tweak as ->fragoff member resides in xt sub-struct.

 net/netfilter/nft_payload.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index b1a9f330a51f..fd87216bc0a9 100644
--- a/net/netfilter/nft_payload.c
+++ b/net/netfilter/nft_payload.c
@@ -194,6 +194,9 @@ static int nft_payload_l4csum_offset(const struct nft_pktinfo *pkt,
 				     struct sk_buff *skb,
 				     unsigned int *l4csum_offset)
 {
+	if (pkt->xt.fragoff)
+		return -1;
+
 	switch (pkt->tprot) {
 	case IPPROTO_TCP:
 		*l4csum_offset = offsetof(struct tcphdr, check);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.19.y] netfilter: nft_payload: do not update layer 4 checksum when mangling fragments
  2022-01-28 11:38 [PATCH 4.19.y] netfilter: nft_payload: do not update layer 4 checksum when mangling fragments Florian Westphal
@ 2022-01-28 11:43 ` Pablo Neira Ayuso
  2022-01-29 11:50 ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2022-01-28 11:43 UTC (permalink / raw)
  To: Florian Westphal; +Cc: stable, netfilter-devel, Steffen Weinreich

On Fri, Jan 28, 2022 at 12:38:21PM +0100, Florian Westphal wrote:
> From: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> commit 4e1860a3863707e8177329c006d10f9e37e097a8 upstream.
> 
> IP fragments do not come with the transport header, hence skip bogus
> layer 4 checksum updates.
> 
> Fixes: 1814096980bb ("netfilter: nft_payload: layer 4 checksum adjustment for pseudoheader fields")
> Reported-and-tested-by: Steffen Weinreich <steve@weinreich.org>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  This is already in the 5.y branches but 4.19 needs a minor
>  tweak as ->fragoff member resides in xt sub-struct.

Thanks for taking care of this -stable submission.

>  net/netfilter/nft_payload.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
> index b1a9f330a51f..fd87216bc0a9 100644
> --- a/net/netfilter/nft_payload.c
> +++ b/net/netfilter/nft_payload.c
> @@ -194,6 +194,9 @@ static int nft_payload_l4csum_offset(const struct nft_pktinfo *pkt,
>  				     struct sk_buff *skb,
>  				     unsigned int *l4csum_offset)
>  {
> +	if (pkt->xt.fragoff)
> +		return -1;
> +
>  	switch (pkt->tprot) {
>  	case IPPROTO_TCP:
>  		*l4csum_offset = offsetof(struct tcphdr, check);
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.19.y] netfilter: nft_payload: do not update layer 4 checksum when mangling fragments
  2022-01-28 11:38 [PATCH 4.19.y] netfilter: nft_payload: do not update layer 4 checksum when mangling fragments Florian Westphal
  2022-01-28 11:43 ` Pablo Neira Ayuso
@ 2022-01-29 11:50 ` Greg KH
  2022-01-29 12:04   ` Florian Westphal
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2022-01-29 11:50 UTC (permalink / raw)
  To: Florian Westphal
  Cc: stable, netfilter-devel, Pablo Neira Ayuso, Steffen Weinreich

On Fri, Jan 28, 2022 at 12:38:21PM +0100, Florian Westphal wrote:
> From: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> commit 4e1860a3863707e8177329c006d10f9e37e097a8 upstream.
> 
> IP fragments do not come with the transport header, hence skip bogus
> layer 4 checksum updates.
> 
> Fixes: 1814096980bb ("netfilter: nft_payload: layer 4 checksum adjustment for pseudoheader fields")
> Reported-and-tested-by: Steffen Weinreich <steve@weinreich.org>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
>  This is already in the 5.y branches but 4.19 needs a minor
>  tweak as ->fragoff member resides in xt sub-struct.

I don't see this commit in the 5.10 or 5.4 branches, am I missing
something?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.19.y] netfilter: nft_payload: do not update layer 4 checksum when mangling fragments
  2022-01-29 11:50 ` Greg KH
@ 2022-01-29 12:04   ` Florian Westphal
  2022-01-29 13:52     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Westphal @ 2022-01-29 12:04 UTC (permalink / raw)
  To: Greg KH
  Cc: Florian Westphal, stable, netfilter-devel, Pablo Neira Ayuso,
	Steffen Weinreich

Greg KH <gregkh@linuxfoundation.org> wrote:
> On Fri, Jan 28, 2022 at 12:38:21PM +0100, Florian Westphal wrote:
> > From: Pablo Neira Ayuso <pablo@netfilter.org>
> > 
> > commit 4e1860a3863707e8177329c006d10f9e37e097a8 upstream.
> > 
> > IP fragments do not come with the transport header, hence skip bogus
> > layer 4 checksum updates.
> > 
> > Fixes: 1814096980bb ("netfilter: nft_payload: layer 4 checksum adjustment for pseudoheader fields")
> > Reported-and-tested-by: Steffen Weinreich <steve@weinreich.org>
> > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> > ---
> >  This is already in the 5.y branches but 4.19 needs a minor
> >  tweak as ->fragoff member resides in xt sub-struct.
> 
> I don't see this commit in the 5.10 or 5.4 branches, am I missing
> something?

Oh, indeed.  Can you place this patch in 5.4 and 5.10 too?

Releases >= v5.14 should be covered given upstream commit works
as-is on those.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.19.y] netfilter: nft_payload: do not update layer 4 checksum when mangling fragments
  2022-01-29 12:04   ` Florian Westphal
@ 2022-01-29 13:52     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2022-01-29 13:52 UTC (permalink / raw)
  To: Florian Westphal
  Cc: stable, netfilter-devel, Pablo Neira Ayuso, Steffen Weinreich

On Sat, Jan 29, 2022 at 01:04:44PM +0100, Florian Westphal wrote:
> Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Fri, Jan 28, 2022 at 12:38:21PM +0100, Florian Westphal wrote:
> > > From: Pablo Neira Ayuso <pablo@netfilter.org>
> > > 
> > > commit 4e1860a3863707e8177329c006d10f9e37e097a8 upstream.
> > > 
> > > IP fragments do not come with the transport header, hence skip bogus
> > > layer 4 checksum updates.
> > > 
> > > Fixes: 1814096980bb ("netfilter: nft_payload: layer 4 checksum adjustment for pseudoheader fields")
> > > Reported-and-tested-by: Steffen Weinreich <steve@weinreich.org>
> > > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> > > Signed-off-by: Florian Westphal <fw@strlen.de>
> > > ---
> > >  This is already in the 5.y branches but 4.19 needs a minor
> > >  tweak as ->fragoff member resides in xt sub-struct.
> > 
> > I don't see this commit in the 5.10 or 5.4 branches, am I missing
> > something?
> 
> Oh, indeed.  Can you place this patch in 5.4 and 5.10 too?

Now done, and it was needed for 4.14.y, so I added it there too, thanks!

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-29 13:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-28 11:38 [PATCH 4.19.y] netfilter: nft_payload: do not update layer 4 checksum when mangling fragments Florian Westphal
2022-01-28 11:43 ` Pablo Neira Ayuso
2022-01-29 11:50 ` Greg KH
2022-01-29 12:04   ` Florian Westphal
2022-01-29 13:52     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).