linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.4.y] tcp: Fix missing range_truesize enlargement in the backport
@ 2018-08-15  9:58 Takashi Iwai
  2018-08-15 11:11 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2018-08-15  9:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, Eric Dumazet, David S . Miller, linux-kernel,
	Michal Kubecek, Jiri Bohac

The 4.4.y stable backport dc6ae4dffd65 for the upstream commit
3d4bf93ac120 ("tcp: detect malicious patterns in
tcp_collapse_ofo_queue()") missed a line that enlarges the
range_truesize value, which broke the whole check.

Fixes: dc6ae4dffd65 ("tcp: detect malicious patterns in tcp_collapse_ofo_queue()")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---

Greg, this is a fix-up specific to 4.4.y stable backport that had a
slightly different form from upstream fix.  I haven't looked at the
older trees, but 4.9.y and later took the upstream fix as is, so this
patch isn't needed for them.

The patch hasn't been tested with the real test case, though; let me
know if the current code is intended.  Thanks!


 net/ipv4/tcp_input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 4a261e078082..9c4c6cd0316e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4835,6 +4835,7 @@ static void tcp_collapse_ofo_queue(struct sock *sk)
 			end = TCP_SKB_CB(skb)->end_seq;
 			range_truesize = skb->truesize;
 		} else {
+			range_truesize += skb->truesize;
 			if (before(TCP_SKB_CB(skb)->seq, start))
 				start = TCP_SKB_CB(skb)->seq;
 			if (after(TCP_SKB_CB(skb)->end_seq, end))
-- 
2.18.0


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

* Re: [PATCH 4.4.y] tcp: Fix missing range_truesize enlargement in the backport
  2018-08-15  9:58 [PATCH 4.4.y] tcp: Fix missing range_truesize enlargement in the backport Takashi Iwai
@ 2018-08-15 11:11 ` Greg Kroah-Hartman
  2018-08-15 12:15   ` Takashi Iwai
  2018-08-15 20:02   ` Michal Kubecek
  0 siblings, 2 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-08-15 11:11 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: stable, Eric Dumazet, David S . Miller, linux-kernel,
	Michal Kubecek, Jiri Bohac

On Wed, Aug 15, 2018 at 11:58:46AM +0200, Takashi Iwai wrote:
> The 4.4.y stable backport dc6ae4dffd65 for the upstream commit
> 3d4bf93ac120 ("tcp: detect malicious patterns in
> tcp_collapse_ofo_queue()") missed a line that enlarges the
> range_truesize value, which broke the whole check.
> 
> Fixes: dc6ae4dffd65 ("tcp: detect malicious patterns in tcp_collapse_ofo_queue()")
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
> 
> Greg, this is a fix-up specific to 4.4.y stable backport that had a
> slightly different form from upstream fix.  I haven't looked at the
> older trees, but 4.9.y and later took the upstream fix as is, so this
> patch isn't needed for them.
> 
> The patch hasn't been tested with the real test case, though; let me
> know if the current code is intended.  Thanks!

Hm, I did the initial backport, and then Eric showed what I got wrong
and fixed that up, so being still wrong is not inconceivable at all :)

Have you tried testing this with the reproducer?  That might be the best
verification here.  If your testing proves to be good, I'll gladly take
this patch, thanks!

greg k-h

thanks,

greg k-h

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

* Re: [PATCH 4.4.y] tcp: Fix missing range_truesize enlargement in the backport
  2018-08-15 11:11 ` Greg Kroah-Hartman
@ 2018-08-15 12:15   ` Takashi Iwai
  2018-08-15 20:02   ` Michal Kubecek
  1 sibling, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2018-08-15 12:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, Eric Dumazet, David S . Miller, linux-kernel,
	Michal Kubecek, Jiri Bohac

On Wed, 15 Aug 2018 13:11:21 +0200,
Greg Kroah-Hartman wrote:
> 
> On Wed, Aug 15, 2018 at 11:58:46AM +0200, Takashi Iwai wrote:
> > The 4.4.y stable backport dc6ae4dffd65 for the upstream commit
> > 3d4bf93ac120 ("tcp: detect malicious patterns in
> > tcp_collapse_ofo_queue()") missed a line that enlarges the
> > range_truesize value, which broke the whole check.
> > 
> > Fixes: dc6ae4dffd65 ("tcp: detect malicious patterns in tcp_collapse_ofo_queue()")
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> > 
> > Greg, this is a fix-up specific to 4.4.y stable backport that had a
> > slightly different form from upstream fix.  I haven't looked at the
> > older trees, but 4.9.y and later took the upstream fix as is, so this
> > patch isn't needed for them.
> > 
> > The patch hasn't been tested with the real test case, though; let me
> > know if the current code is intended.  Thanks!
> 
> Hm, I did the initial backport, and then Eric showed what I got wrong
> and fixed that up, so being still wrong is not inconceivable at all :)
> 
> Have you tried testing this with the reproducer?  That might be the best
> verification here.  If your testing proves to be good, I'll gladly take
> this patch, thanks!

No, I haven't tested it, just followed from the thread in the past
(and hope that our QA team will test that sooner or later :)
Will let you know if we find any issues in the current tree.

And, if the current code works as intended, it's great, of course.


thanks,

Takashi

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

* Re: [PATCH 4.4.y] tcp: Fix missing range_truesize enlargement in the backport
  2018-08-15 11:11 ` Greg Kroah-Hartman
  2018-08-15 12:15   ` Takashi Iwai
@ 2018-08-15 20:02   ` Michal Kubecek
  2018-08-16 15:16     ` Greg Kroah-Hartman
  1 sibling, 1 reply; 5+ messages in thread
From: Michal Kubecek @ 2018-08-15 20:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Takashi Iwai, stable, Eric Dumazet, David S . Miller,
	linux-kernel, Jiri Bohac

On Wed, Aug 15, 2018 at 01:11:21PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Aug 15, 2018 at 11:58:46AM +0200, Takashi Iwai wrote:
> > The 4.4.y stable backport dc6ae4dffd65 for the upstream commit
> > 3d4bf93ac120 ("tcp: detect malicious patterns in
> > tcp_collapse_ofo_queue()") missed a line that enlarges the
> > range_truesize value, which broke the whole check.
> > 
> > Fixes: dc6ae4dffd65 ("tcp: detect malicious patterns in tcp_collapse_ofo_queue()")
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> > 
> > Greg, this is a fix-up specific to 4.4.y stable backport that had a
> > slightly different form from upstream fix.  I haven't looked at the
> > older trees, but 4.9.y and later took the upstream fix as is, so this
> > patch isn't needed for them.
> > 
> > The patch hasn't been tested with the real test case, though; let me
> > know if the current code is intended.  Thanks!
> 
> Hm, I did the initial backport, and then Eric showed what I got wrong
> and fixed that up, so being still wrong is not inconceivable at all :)

Takashi's follow-up patch is what makes the backport work the same way
as the original mainline commit 3d4bf93ac120. Without it, range_truesize
will be always equal to truesize of first packet in a contiguous range
so that the condition

  range_truesize != head->truesize

will be always false (and there would be no point having range_truesize
variable at all).

Michal Kubecek


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

* Re: [PATCH 4.4.y] tcp: Fix missing range_truesize enlargement in the backport
  2018-08-15 20:02   ` Michal Kubecek
@ 2018-08-16 15:16     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-08-16 15:16 UTC (permalink / raw)
  To: Michal Kubecek
  Cc: Takashi Iwai, stable, Eric Dumazet, David S . Miller,
	linux-kernel, Jiri Bohac

On Wed, Aug 15, 2018 at 10:02:30PM +0200, Michal Kubecek wrote:
> On Wed, Aug 15, 2018 at 01:11:21PM +0200, Greg Kroah-Hartman wrote:
> > On Wed, Aug 15, 2018 at 11:58:46AM +0200, Takashi Iwai wrote:
> > > The 4.4.y stable backport dc6ae4dffd65 for the upstream commit
> > > 3d4bf93ac120 ("tcp: detect malicious patterns in
> > > tcp_collapse_ofo_queue()") missed a line that enlarges the
> > > range_truesize value, which broke the whole check.
> > > 
> > > Fixes: dc6ae4dffd65 ("tcp: detect malicious patterns in tcp_collapse_ofo_queue()")
> > > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > > ---
> > > 
> > > Greg, this is a fix-up specific to 4.4.y stable backport that had a
> > > slightly different form from upstream fix.  I haven't looked at the
> > > older trees, but 4.9.y and later took the upstream fix as is, so this
> > > patch isn't needed for them.
> > > 
> > > The patch hasn't been tested with the real test case, though; let me
> > > know if the current code is intended.  Thanks!
> > 
> > Hm, I did the initial backport, and then Eric showed what I got wrong
> > and fixed that up, so being still wrong is not inconceivable at all :)
> 
> Takashi's follow-up patch is what makes the backport work the same way
> as the original mainline commit 3d4bf93ac120. Without it, range_truesize
> will be always equal to truesize of first packet in a contiguous range
> so that the condition
> 
>   range_truesize != head->truesize
> 
> will be always false (and there would be no point having range_truesize
> variable at all).

Thanks, I've now queued this up.

greg k-h

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

end of thread, other threads:[~2018-08-16 15:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15  9:58 [PATCH 4.4.y] tcp: Fix missing range_truesize enlargement in the backport Takashi Iwai
2018-08-15 11:11 ` Greg Kroah-Hartman
2018-08-15 12:15   ` Takashi Iwai
2018-08-15 20:02   ` Michal Kubecek
2018-08-16 15:16     ` Greg Kroah-Hartman

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).