Skip to contentSkip to conversation

: tcp: Fix queue traversal in tcp_use_frto().

PATCH In review David Miller 2 participants 4 messages Sep 23, 2008 – Sep 24, 2008

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/1 : tcp: Fix queue traversal in tcp_use_frto().

One more skb_queue_next() BUG trigger. I double audited the remaining tcp_write_queue_next() cases and they should all be good.

tcp: Fix queue traversal in tcp_use_frto().

We must check tcp_skb_is_last() before doing a tcp_write_queue_next().

---
 net/ipv4/tcp_input.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/ipv4/tcp_input.c +2 -0
index cbfe13d..3b76bce 100644
@@ -1746,6 +1746,8 @@ int tcp_use_frto(struct sock *sk)
 		return 0;
 
 	skb = tcp_write_queue_head(sk);
+	if (tcp_skb_is_last(sk, skb))
+		return 1;
 	skb = tcp_write_queue_next(sk, skb);	/* Skips head */
 	tcp_for_write_queue_from(skb, sk) {
 		if (skb == tcp_send_head(sk))
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 20 lines · David Miller

One more skb_queue_next() BUG trigger. I double audited the remaining tcp_write_queue_next() cases and they should all be good.

tcp: Fix queue traversal in tcp_use_frto().

We must check tcp_skb_is_last() before doing a tcp_write_queue_next().

---
 net/ipv4/tcp_input.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/ipv4/tcp_input.c +0 -0
index cbfe13d..3b76bce 100644

net/ipv4/tcp_input.c int tcp_use_frto(struct sock *sk) · line 1753

Quoted 8 lines
net/ipv4/tcp_input.c +2 -0
@@ -1746,6 +1746,8 @@ int tcp_use_frto(struct sock *sk)
 		return 0;
 
 	skb = tcp_write_queue_head(sk);
+	if (tcp_skb_is_last(sk, skb))
+		return 1;
 	skb = tcp_write_queue_next(sk, skb);	/* Skips head */
 	tcp_for_write_queue_from(skb, sk) {
 		if (skb == tcp_send_head(sk))

For the record (as you probably know it already), this wasn't actually a real bug though it hits your BUG_ON since tcp_for_write_queue_from exits immediately, no garbage gets dereferenced.

Signature · 1 line
 i.
author maintainer
#2 lore raw

From: "Ilpo Järvinen" <[email protected]>
Date: Tue, 23 Sep 2008 22:18:33 +0300 (EEST)

Quoted 3 lines

For the record (as you probably know it already), this wasn't actually a real bug though it hits your BUG_ON since tcp_for_write_queue_from exits immediately, no garbage gets dereferenced.

Yes, that is correct.

It is actually disappointing for me, I thought maybe it would catch a real bug somewhere :-)

#3 lore raw
Quoted 11 lines · David Miller

From: "Ilpo Järvinen" <[email protected]>
Date: Tue, 23 Sep 2008 22:18:33 +0300 (EEST)

Quoted 3 lines

For the record (as you probably know it already), this wasn't actually a real bug though it hits your BUG_ON since tcp_for_write_queue_from exits immediately, no garbage gets dereferenced.

Yes, that is correct.

It is actually disappointing for me, I thought maybe it would catch a real bug somewhere :-)

Rest assured, it will definately do that once some rewrite or so happens... :-)

Signature · 1 line
 i.