aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pppol2tp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pppol2tp.c')
-rw-r--r--drivers/net/pppol2tp.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index 70cfdb46aa27..f9298827a76c 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -783,14 +783,18 @@ static int pppol2tp_recvmsg(struct kiocb *iocb, struct socket *sock,
783 err = 0; 783 err = 0;
784 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, 784 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
785 flags & MSG_DONTWAIT, &err); 785 flags & MSG_DONTWAIT, &err);
786 if (skb) { 786 if (!skb)
787 err = memcpy_toiovec(msg->msg_iov, (unsigned char *) skb->data, 787 goto end;
788 skb->len); 788
789 if (err < 0) 789 if (len > skb->len)
790 goto do_skb_free; 790 len = skb->len;
791 err = skb->len; 791 else if (len < skb->len)
792 } 792 msg->msg_flags |= MSG_TRUNC;
793do_skb_free: 793
794 err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, len);
795 if (likely(err == 0))
796 err = len;
797
794 kfree_skb(skb); 798 kfree_skb(skb);
795end: 799end:
796 return err; 800 return err;