Skip to contentSkip to conversation

tipc: initialize 'validated' field of received packets

PATCH Applied Jon Maloy 2 participants 2 messages Jul 17, 2019

Subsystems (3)
lore
Share & tools
lore

Jon Maloy

author
#0 lore raw

PATCH 1/1 tipc: initialize 'validated' field of received packets

The tipc_msg_validate() function leaves a boolean flag 'validated' in the validated buffer's control block, to avoid performing this action more than once. However, at reception of new packets, the position of this field may already have been set by lower layer protocols, so that the packet is erroneously perceived as already validated by TIPC.

We fix this by initializing the said field to 'false' before performing the initial validation.

---
 net/tipc/node.c | 1 +
 1 file changed, 1 insertion(+)
net/tipc/node.c +1 -0
index 324a1f9..3a5be1d 100644
@@ -1807,6 +1807,7 @@ void tipc_rcv(struct net *net, struct sk_buff *skb, struct tipc_bearer *b)
 	__skb_queue_head_init(&xmitq);
 
 	/* Ensure message is well-formed before touching the header */
+	TIPC_SKB_CB(skb)->validated = false;
 	if (unlikely(!tipc_msg_validate(&skb)))
 		goto discard;
 	hdr = buf_msg(skb);
Signature · 1 line
2.1.4
maintainer Applied
#1 lore raw

From: Jon Maloy <[email protected]>
Date: Wed, 17 Jul 2019 23:43:44 +0200

Quoted 10 lines

The tipc_msg_validate() function leaves a boolean flag 'validated' in the validated buffer's control block, to avoid performing this action more than once. However, at reception of new packets, the position of this field may already have been set by lower layer protocols, so that the packet is erroneously perceived as already validated by TIPC.

We fix this by initializing the said field to 'false' before performing the initial validation.

Applied.