Skip to contentSkip to conversation

PPP handling fragmented skbuff's

PATCH Applied Stephen Hemminger 2 participants 3 messages Jun 27, 2003 – Jul 10, 2003

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

PATCH 1/1 PPP handling fragmented skbuff's

Don't think this ever happens today, but if PPP ever gets a fragmented a skbuff and decides to copy it then bad things will happen. The following replaces the places that memcpy() with skb_copy_bits().

Please review carefully before applying, it builds and runs but can't really force these code path to occur under normal systems and devices.

drivers/net/ppp_generic.c +3 -3
diff -Nru a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
@@ -844,7 +844,7 @@
 		if (ns == 0)
 			goto outf;
 		skb_reserve(ns, dev->hard_header_len);
-		memcpy(skb_put(ns, skb->len), skb->data, skb->len);
+		skb_copy_bits(skb, 0, skb_put(ns, skb->len), skb->len);
 		kfree_skb(skb);
 		skb = ns;
 	}
@@ -1455,7 +1455,7 @@
 				goto err;
 			}
 			skb_reserve(ns, 2);
-			memcpy(skb_put(ns, skb->len), skb->data, skb->len);
+			skb_copy_bits(skb, 0, skb_put(ns, skb->len), skb->len);
 			kfree_skb(skb);
 			skb = ns;
 		}
@@ -1826,7 +1826,7 @@
 		if (head != tail)
 			/* copy to a single skb */
 			for (p = head; p != tail->next; p = p->next)
-				memcpy(skb_put(skb, p->len), p->data, p->len);
+				skb_copy_bits(p, 0, skb_put(skb, p->len), p->len);
 		ppp->nextseq = tail->sequence + 1;
 		head = tail->next;
 	}
#1 lore raw

From: Stephen Hemminger <[email protected]>
Date: Fri, 27 Jun 2003 16:35:24 -0700

Don't think this ever happens today, but if PPP ever gets a fragmented a skbuff and decides to copy it then bad things will happen. The following replaces the places that memcpy() with skb_copy_bits().

Please review carefully before applying, it builds and runs but can't really force these code path to occur under normal systems and devices.

It looks ok. But I'll let this one sit over the weekend before applying so others can test it out.

#2 lore raw
In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>
Date: Fri, 27 Jun 2003 16:35:24 -0700

Don't think this ever happens today, but if PPP ever gets a fragmented a skbuff and decides to copy it then bad things will happen. The following replaces the places that memcpy() with skb_copy_bits().

Applied, thanks Stephen.