Skip to content

Commit

Permalink
l2tp: Fix PPP header erasure and memory leak
Browse files Browse the repository at this point in the history
[ Upstream commit 55b92b7 ]

Copy user data after PPP framing header. This prevents erasure of the
added PPP header and avoids leaking two bytes of uninitialised memory
at the end of skb's data buffer.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Guillaume Nault authored and Greg Kroah-Hartman committed Jun 27, 2013
1 parent b4d45a2 commit 6e09261
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/l2tp/l2tp_ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,12 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
skb_put(skb, 2);

/* Copy user data into skb */
error = memcpy_fromiovec(skb->data, m->msg_iov, total_len);
error = memcpy_fromiovec(skb_put(skb, total_len), m->msg_iov,
total_len);
if (error < 0) {
kfree_skb(skb);
goto error_put_sess_tun;
}
skb_put(skb, total_len);

l2tp_xmit_skb(session, skb, session->hdr_len);

Expand Down

0 comments on commit 6e09261

Please sign in to comment.