netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT] syncppp needs to pullup headers
@ 2003-10-03 18:43 Stephen Hemminger
  2003-10-04  5:55 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2003-10-03 18:43 UTC (permalink / raw)
  To: Jeff Garzik, David S. Miller; +Cc: netdev

In 2.6.0-test6 wan syncppp driver claims to be a "new" protocol and handle shared skb's
but it needs to make sure data is contiguous before overlaying headers.  
It is not a serious problem because the sync drivers never generate nonlinear skbuff's
anyway.

Don't have hardware that uses this, so could someone please do a sanity 
test on this.

diff -Nru a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
--- a/drivers/net/wan/syncppp.c	Fri Oct  3 11:28:11 2003
+++ b/drivers/net/wan/syncppp.c	Fri Oct  3 11:28:11 2003
@@ -236,7 +236,7 @@
 		sp->ipkts++;
 	}
 
-	if (skb->len <= PPP_HEADER_LEN) {
+	if (!pskb_may_pull(skb, PPP_HEADER_LEN)) {
 		/* Too small packet, drop it. */
 		if (sp->pp_flags & PP_DEBUG)
 			printk (KERN_DEBUG "%s: input packet is too small, %d bytes\n",
@@ -473,7 +473,7 @@
 	u8 *p, opt[6];
 	u32 rmagic;
 
-	if (len < 4) {
+	if (!pskb_may_pull(skb, sizeof(struct lcp_header))) {
 		if (sp->pp_flags & PP_DEBUG)
 			printk (KERN_WARNING "%s: invalid lcp packet length: %d bytes\n",
 				dev->name, len);
@@ -707,7 +707,9 @@
 	struct cisco_packet *h;
 	struct net_device *dev = sp->pp_if;
 
-	if (skb->len != CISCO_PACKET_LEN && skb->len != CISCO_BIG_PACKET_LEN) {
+	if (!pskb_may_pull(skb, sizeof(struct cisco_packet))
+	    || (skb->len != CISCO_PACKET_LEN
+		&& skb->len != CISCO_BIG_PACKET_LEN)) {
 		if (sp->pp_flags & PP_DEBUG)
 			printk (KERN_WARNING "%s: invalid cisco packet length: %d bytes\n",
 				dev->name,  skb->len);
@@ -1211,8 +1213,7 @@
 	struct net_device *dev = sp->pp_if;
 	int len = skb->len;
 
-	if (len < 4) 
-	{
+	if (!pskb_may_pull(skb, sizeof(struct lcp_header))) {
 		if (sp->pp_flags & PP_DEBUG)
 			printk (KERN_WARNING "%s: invalid ipcp packet length: %d bytes\n",
 				dev->name,  len);

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

* Re: [RFT] syncppp needs to pullup headers
  2003-10-03 18:43 [RFT] syncppp needs to pullup headers Stephen Hemminger
@ 2003-10-04  5:55 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-10-04  5:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: jgarzik, netdev

On Fri, 3 Oct 2003 11:43:47 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:

> In 2.6.0-test6 wan syncppp driver claims to be a "new" protocol and handle shared skb's
> but it needs to make sure data is contiguous before overlaying headers.  
> It is not a serious problem because the sync drivers never generate nonlinear skbuff's
> anyway.

This looks obvious enough and correct to me, applied.

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

end of thread, other threads:[~2003-10-04  5:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-03 18:43 [RFT] syncppp needs to pullup headers Stephen Hemminger
2003-10-04  5:55 ` 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).