Skip to contentSkip to conversation

tipc: clear 'next'-pointer of message fragments before reassembly

PATCH Applied Jon Maloy 2 participants 2 messages Jul 11, 2014

Subsystems (3)
lore
Share & tools
lore

Jon Maloy

author
#0 lore raw

PATCH 1/1 tipc: clear 'next'-pointer of message fragments before reassembly

If the 'next' pointer of the last fragment buffer in a message is not zeroed before reassembly, we risk ending up with a corrupt message, since the reassembly function itself isn't doing this.

Currently, when a buffer is retrieved from the deferred queue of the broadcast link, the next pointer is not cleared, with the result as described above.

This commit corrects this, and thereby fixes a bug that may occur when long broadcast messages are transmitted across dual interfaces. The bug has been present since 40ba3cdf542a469aaa9083fa041656e59b109b90 ("tipc:
message reassembly using fragment chain")

This commit should be applied to both net and net-next.

---
 net/tipc/bcast.c |    1 +
 1 file changed, 1 insertion(+)
net/tipc/bcast.c +1 -0
index 2663167..55c6c9d 100644
@@ -559,6 +559,7 @@ receive:
 
 		buf = node->bclink.deferred_head;
 		node->bclink.deferred_head = buf->next;
+		buf->next = NULL;
 		node->bclink.deferred_size--;
 		goto receive;
 	}
Signature · 1 line
1.7.9.5
maintainer Applied
#1 lore raw

From: Jon Maloy <[email protected]>
Date: Fri, 11 Jul 2014 08:45:27 -0400

Quoted 8 lines

If the 'next' pointer of the last fragment buffer in a message is not zeroed before reassembly, we risk ending up with a corrupt message, since the reassembly function itself isn't doing this.

Currently, when a buffer is retrieved from the deferred queue of the broadcast link, the next pointer is not cleared, with the result as described above.

Quoted 8 lines

This commit corrects this, and thereby fixes a bug that may occur when long broadcast messages are transmitted across dual interfaces. The bug has been present since 40ba3cdf542a469aaa9083fa041656e59b109b90 ("tipc:
message reassembly using fragment chain")

This commit should be applied to both net and net-next.

Applied, but I have to say this isn't the first time I've seen the TIPC buffer chaining code require a bug fix like this.

That gives me the impression that it's done in an error prone way, so you may want to take that into consideration and do something to make these lists harder to mismanage.

Thanks.