netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PPP handling fragmented skbuff's
@ 2003-06-27 23:35 Stephen Hemminger
  2003-06-28  7:21 ` David S. Miller
  2003-07-10  2:08 ` David S. Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Hemminger @ 2003-06-27 23:35 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

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.

diff -Nru a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
--- a/drivers/net/ppp_generic.c	Fri Jun 27 16:13:38 2003
+++ b/drivers/net/ppp_generic.c	Fri Jun 27 16:13:38 2003
@@ -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;
 	}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-07-10  2:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-27 23:35 [PATCH] PPP handling fragmented skbuff's Stephen Hemminger
2003-06-28  7:21 ` David S. Miller
2003-07-10  2:08 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).