[BUG?] tcp: potential bug in tcp_is_sackblock_valid()

Subsystems: networking [general], networking [tcp], the rest

10 messages, 6 authors, 2011-09-20 · open the first message on its own page

[BUG?] tcp: potential bug in tcp_is_sackblock_valid()

From: Yan, Zheng <hidden>
Date: 2011-09-09 01:45:54

Hi all,

I found a check in tcp_is_sackblock_valid() is suspicious. It against
its comment and RFC. I think the correct check should be:

---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 385c470..a5d01b1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1124,7 +1124,7 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
                return 0;
 
        /* ...Then it's D-SACK, and must reside below snd_una completely */
-       if (!after(end_seq, tp->snd_una))
+       if (after(end_seq, tp->snd_una))
                return 0;
 
        if (!before(start_seq, tp->undo_marker))
---
I also checked /proc/net/netstat of my laptop, found TCPDSACKIgnoredOld
field is not zero. Maybe it's caused by the bug.

Regards
Yan, Zheng

Re: [BUG?] tcp: potential bug in tcp_is_sackblock_valid()

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2011-09-09 01:54:34

On Fri, Sep 09, 2011 at 09:45:52AM +0800, Yan, Zheng wrote:
quoted hunk
Hi all,

I found a check in tcp_is_sackblock_valid() is suspicious. It against
its comment and RFC. I think the correct check should be:

---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 385c470..a5d01b1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1124,7 +1124,7 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
                return 0;
 
        /* ...Then it's D-SACK, and must reside below snd_una completely */
-       if (!after(end_seq, tp->snd_una))
+       if (after(end_seq, tp->snd_una))
                return 0;
 
        if (!before(start_seq, tp->undo_marker))
---
I also checked /proc/net/netstat of my laptop, found TCPDSACKIgnoredOld
field is not zero. Maybe it's caused by the bug.
Yes this looks like a typo.  Please resend your patch with a
description and signed-off-by line.

Thanks,
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Re: [BUG?] tcp: potential bug in tcp_is_sackblock_valid()

From: Yan, Zheng <hidden>
Date: 2011-09-09 02:11:00

On 09/09/2011 09:54 AM, Herbert Xu wrote:
On Fri, Sep 09, 2011 at 09:45:52AM +0800, Yan, Zheng wrote:
quoted
Hi all,

I found a check in tcp_is_sackblock_valid() is suspicious. It against
its comment and RFC. I think the correct check should be:

---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 385c470..a5d01b1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1124,7 +1124,7 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
                return 0;
 
        /* ...Then it's D-SACK, and must reside below snd_una completely */
-       if (!after(end_seq, tp->snd_una))
+       if (after(end_seq, tp->snd_una))
                return 0;
 
        if (!before(start_seq, tp->undo_marker))
---
I also checked /proc/net/netstat of my laptop, found TCPDSACKIgnoredOld
field is not zero. Maybe it's caused by the bug.
Yes this looks like a typo.  Please resend your patch with a
description and signed-off-by line.
I think the bug has a big influence on tcp DSACKs. It's better to
leave it to people who fully understand tcp code.

Thanks.

Re: [BUG?] tcp: potential bug in tcp_is_sackblock_valid()

From: Ilpo Järvinen <hidden>
Date: 2011-09-09 08:04:00

On Fri, 9 Sep 2011, Yan, Zheng wrote:
On 09/09/2011 09:54 AM, Herbert Xu wrote:
quoted
On Fri, Sep 09, 2011 at 09:45:52AM +0800, Yan, Zheng wrote:
quoted
I found a check in tcp_is_sackblock_valid() is suspicious. It against
its comment and RFC. I think the correct check should be:
---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 385c470..a5d01b1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1124,7 +1124,7 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
                return 0;
 
        /* ...Then it's D-SACK, and must reside below snd_una completely */
-       if (!after(end_seq, tp->snd_una))
+       if (after(end_seq, tp->snd_una))
                return 0;
 
        if (!before(start_seq, tp->undo_marker))
---
I also checked /proc/net/netstat of my laptop, found TCPDSACKIgnoredOld
field is not zero. Maybe it's caused by the bug.
Hmm, some Ignored I was expecting to see even when nothing was wrong but I 
think it might have been the other counter... too long time already passed 
to remember all the details I've been thinking.
quoted
Yes this looks like a typo.  Please resend your patch with a
description and signed-off-by line.
I think the bug has a big influence on tcp DSACKs. It's better to
leave it to people who fully understand tcp code.
Indeed, it looks like a double negative error.

-- 
 i.

Re: [BUG?] tcp: potential bug in tcp_is_sackblock_valid()

From: Eric Dumazet <hidden>
Date: 2011-09-18 19:35:52

Le vendredi 09 septembre 2011 à 09:45 +0800, Yan, Zheng a écrit :
quoted hunk
Hi all,

I found a check in tcp_is_sackblock_valid() is suspicious. It against
its comment and RFC. I think the correct check should be:

---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 385c470..a5d01b1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1124,7 +1124,7 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
                return 0;
 
        /* ...Then it's D-SACK, and must reside below snd_una completely */
-       if (!after(end_seq, tp->snd_una))
+       if (after(end_seq, tp->snd_una))
                return 0;
 
        if (!before(start_seq, tp->undo_marker))
---
Acked-by: Eric Dumazet <redacted>

This bug was introduced in 2.6.24 by commit 5b3c9882

Re: [BUG?] tcp: potential bug in tcp_is_sackblock_valid()

From: David Miller <davem@davemloft.net>
Date: 2011-09-19 01:09:36

From: Eric Dumazet <redacted>
Date: Sun, 18 Sep 2011 21:35:44 +0200
Le vendredi 09 septembre 2011 à 09:45 +0800, Yan, Zheng a écrit :
quoted
Hi all,

I found a check in tcp_is_sackblock_valid() is suspicious. It against
its comment and RFC. I think the correct check should be:

---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 385c470..a5d01b1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1124,7 +1124,7 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
                return 0;
 
        /* ...Then it's D-SACK, and must reside below snd_una completely */
-       if (!after(end_seq, tp->snd_una))
+       if (after(end_seq, tp->snd_una))
                return 0;
 
        if (!before(start_seq, tp->undo_marker))
---
Acked-by: Eric Dumazet <redacted>

This bug was introduced in 2.6.24 by commit 5b3c9882
Yan, please repost this patch with proper commit message and signoffs
so I can apply it, thanks.

[PATCH] tcp: fix validation of D-SACK

From: Yan, Zheng <hidden>
Date: 2011-09-19 02:05:33

D-SACK is allowed to reside below snd_una. But the corresponding check
in tcp_is_sackblock_valid() is the exact opposite. It looks like a typo.

Signed-off-by: Zheng Yan <redacted>
Acked-by: Eric Dumazet <redacted>
---
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index ea0d218..21fab3e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1124,7 +1124,7 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
 		return 0;
 
 	/* ...Then it's D-SACK, and must reside below snd_una completely */
-	if (!after(end_seq, tp->snd_una))
+	if (after(end_seq, tp->snd_una))
 		return 0;
 
 	if (!before(start_seq, tp->undo_marker))

Re: [PATCH] tcp: fix validation of D-SACK

From: David Miller <davem@davemloft.net>
Date: 2011-09-19 02:37:50

From: "Yan, Zheng" <redacted>
Date: Mon, 19 Sep 2011 10:05:31 +0800
D-SACK is allowed to reside below snd_una. But the corresponding check
in tcp_is_sackblock_valid() is the exact opposite. It looks like a typo.

Signed-off-by: Zheng Yan <redacted>
Acked-by: Eric Dumazet <redacted>
Applied, thanks.

Re: [PATCH] tcp: fix validation of D-SACK

From: Jan Ceuleers <hidden>
Date: 2011-09-19 17:30:47

On 09/19/2011 04:37 AM, David Miller wrote:
quoted
D-SACK is allowed to reside below snd_una. But the corresponding check
in tcp_is_sackblock_valid() is the exact opposite. It looks like a typo.

Signed-off-by: Zheng Yan<redacted>
Acked-by: Eric Dumazet<redacted>
Applied, thanks.
Dave,

Have you also queued it up for stable as per Eric's remark that this was introduced in 2.6.24?

Sorry if this is implied in your workflow.

Thanks, Jan

Re: [PATCH] tcp: fix validation of D-SACK

From: David Miller <davem@davemloft.net>
Date: 2011-09-20 18:50:40

From: Jan Ceuleers <redacted>
Date: Mon, 19 Sep 2011 19:29:16 +0200
Have you also queued it up for stable as per Eric's remark that this
was introduced in 2.6.24?
Yes, I have.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help