aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ppp_generic.c
diff options
context:
space:
mode:
authorSimon Arlott <simon@fire.lp0.eu>2010-05-03 06:20:27 -0400
committerDavid S. Miller <davem@davemloft.net>2010-05-03 16:27:00 -0400
commit19937d0482cfe194fe52e97e59aa58ec911de0d1 (patch)
treeb05220257871cfa0c13d22780a8af8a891f0e5c8 /drivers/net/ppp_generic.c
parentea8420e9f5dff7324607671f0b7ab7fbf726339d (diff)
ppp_generic: handle non-linear skbs when passing them to pppd
Frequently when using PPPoE with an interface MTU greater than 1500, the skb is likely to be non-linear. If the skb needs to be passed to pppd then the skb data must be read correctly. The previous commit fixes an issue with accidentally sending skbs to pppd based on an invalid read of the protocol type. When that error occurred pppd was reading invalid skb data too. Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ppp_generic.c')
-rw-r--r--drivers/net/ppp_generic.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 75e8903c3754..8518a2e58e53 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -405,6 +405,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
405 DECLARE_WAITQUEUE(wait, current); 405 DECLARE_WAITQUEUE(wait, current);
406 ssize_t ret; 406 ssize_t ret;
407 struct sk_buff *skb = NULL; 407 struct sk_buff *skb = NULL;
408 struct iovec iov;
408 409
409 ret = count; 410 ret = count;
410 411
@@ -448,7 +449,9 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
448 if (skb->len > count) 449 if (skb->len > count)
449 goto outf; 450 goto outf;
450 ret = -EFAULT; 451 ret = -EFAULT;
451 if (copy_to_user(buf, skb->data, skb->len)) 452 iov.iov_base = buf;
453 iov.iov_len = count;
454 if (skb_copy_datagram_iovec(skb, 0, &iov, skb->len))
452 goto outf; 455 goto outf;
453 ret = skb->len; 456 ret = skb->len;
454 457