From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH net,stable 1/2] l2tp: Fix PPP header erasure and memory leak Date: Wed, 12 Jun 2013 07:41:20 -0700 Message-ID: <1371048080.3252.61.camel@edumazet-glaptop> References: <20130612140723.GB3500@alphalink.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, James Chapman , David Miller To: Guillaume Nault Return-path: Received: from mail-ea0-f170.google.com ([209.85.215.170]:32882 "EHLO mail-ea0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454Ab3FLOlY (ORCPT ); Wed, 12 Jun 2013 10:41:24 -0400 Received: by mail-ea0-f170.google.com with SMTP id h10so6972603eaj.15 for ; Wed, 12 Jun 2013 07:41:23 -0700 (PDT) In-Reply-To: <20130612140723.GB3500@alphalink.fr> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 2013-06-12 at 16:07 +0200, Guillaume Nault wrote: > 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 > --- > net/l2tp/l2tp_ppp.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c > index 637a341..681c626 100644 > --- a/net/l2tp/l2tp_ppp.c > +++ b/net/l2tp/l2tp_ppp.c > @@ -346,12 +346,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); > I see no real change in your patch. skb_put(skb, X) returns skb->data before the put operation. Could you elaborate ?