Skip to contentSkip to conversation

pull request: batman-adv 2011-02-08

PATCH New Sven Eckelmann 2 participants 3 messages Feb 7, 2011 – Feb 8, 2011 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi,

I would like to propose following patch for net-2.6.git/2.6.38 which fixes a possible kernel oops in the unicast fragmentation code.

thanks,
Sven

The following changes since commit 1181e1daace88018b2ff66592aa10a4791d705ff:

batman-adv: Make vis info stack traversal threadsafe (2011-01-30 10:32:08 +0100)

are available in the git repository at:
git://git.open-mesh.org/ecsv/linux-merge.git batman-adv/merge

Sven Eckelmann (1):
batman-adv: Linearize fragment packets before merge

 net/batman-adv/unicast.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

A message that is not in the archive (sent off-list or not yet received): 1297123161-25612-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org

#2 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.

[[email protected]: Move return from function to the end]
---
 net/batman-adv/unicast.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
net/batman-adv/unicast.c +10 -5
index ee41fef..d1a6113 100644
@@ -50,12 +50,12 @@ static struct sk_buff *frag_merge_packet(struct list_head *head,
 		skb = tfp->skb;
 	}
 
+	if (skb_linearize(skb) < 0 || skb_linearize(tmp_skb) < 0)
+		goto err;
+
 	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 */
-		kfree_skb(tfp->skb);
-		return NULL;
-	}
+	if (pskb_expand_head(skb, 0, tmp_skb->len, GFP_ATOMIC) < 0)
+		goto err;
 
 	/* move free entry to end */
 	tfp->skb = NULL;
@@ -70,6 +70,11 @@ static struct sk_buff *frag_merge_packet(struct list_head *head,
 	unicast_packet->packet_type = BAT_UNICAST;
 
 	return skb;
+
+err:
+	/* free buffered skb, skb will be freed later */
+	kfree_skb(tfp->skb);
+	return NULL;
 }
 
 static void frag_create_entry(struct list_head *head, struct sk_buff *skb)
Signature · 1 line
1.7.2.3
maintainer
#3 lore raw
In reply to Sven Eckelmann

From: Sven Eckelmann <[email protected]>
Date: Tue, 8 Feb 2011 00:59:20 +0100

Quoted 2 lines

I would like to propose following patch for net-2.6.git/2.6.38 which fixes a possible kernel oops in the unicast fragmentation code.

...

Quoted 6 lines

The following changes since commit 1181e1daace88018b2ff66592aa10a4791d705ff:

batman-adv: Make vis info stack traversal threadsafe (2011-01-30 10:32:08 +0100)

are available in the git repository at:
git://git.open-mesh.org/ecsv/linux-merge.git batman-adv/merge

Pulled, thanks.