Skip to contentSkip to conversation

batman-adv: Linearize fragment packets before merge

PATCH Applied Sven Eckelmann 2 participants 2 messages Feb 5, 2011 – Feb 6, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 batman-adv: Linearize fragment packets before merge

We access the data inside the skbs of two fragments directly using memmove during the merge. The data of the skb could span over multiple skb pages. An direct access without knowledge about the pages would lead to an invalid memory access.

---
 batman-adv/unicast.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
batman-adv/unicast.c +5 -0
index 6a9ab61..04b152c 100644
@@ -50,6 +50,11 @@ static struct sk_buff *frag_merge_packet(struct list_head *head,
 		skb = tfp->skb;
 	}
 
+	if (skb_linearize(skb) < 0 || skb_linearize(tmp_skb) < 0) {
+		kfree_skb(tfp->skb);
+		return NULL;
+	}
+
 	skb_pull(tmp_skb, sizeof(struct unicast_frag_packet));
 	if (pskb_expand_head(skb, 0, tmp_skb->len, GFP_ATOMIC) < 0) {
 		/* free buffered skb, skb will be freed later */
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 4 lines · On Saturday 05 February 2011 22:41:58 Sven Eckelmann wrote:

We access the data inside the skbs of two fragments directly using memmove during the merge. The data of the skb could span over multiple skb pages. An direct access without knowledge about the pages would lead to an invalid memory access.

Applied in revision 1933.

Thanks,
Marek