From patchwork Mon May 3 20:20:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Arlott X-Patchwork-Id: 51527 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 72C7EB7D1B for ; Tue, 4 May 2010 06:20:35 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756772Ab0ECUUa (ORCPT ); Mon, 3 May 2010 16:20:30 -0400 Received: from proxima.lp0.eu ([81.2.80.65]:54378 "EHLO proxima.lp0.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756747Ab0ECUU3 (ORCPT ); Mon, 3 May 2010 16:20:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fire.lp0.eu; s=exim; h=; bh=9nwBkrGXXujNAzLtL6XBpRrvAT6iBKsttT2yC3sPl9c=; b=DDIWCcKFb59ms+ax+QgjWtlPstGn7hySUVw9c63cZJt0yOrCnfjWWCSsh7drklCc7zENWVI3tY3+fAuSHDMcXyrlqQOiwBRyVr3YJz+S+QFFsQfrJYzkz93Di+F75pKh; Received: from redrum.lp0.eu ([2001:8b0:ffea:0:2e0:81ff:fe4d:2bec]:50056 ident=simon) by proxima.lp0.eu ([2001:8b0:ffea:0:205:b4ff:fe12:530]:465) with esmtpsav (TLSv1:CAMELLIA256-SHA:256/CN=Simon Arlott) id 1O927v-0008FV-Bt; Mon, 03 May 2010 21:20:27 +0100 Message-ID: <4BDF300B.1040103@simon.arlott.org.uk> Date: Mon, 03 May 2010 21:20:27 +0100 From: Simon Arlott User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100404 Thunderbird/3.0.3 MIME-Version: 1.0 To: David Miller CC: netdev , paulus@samba.org, linux-ppp@vger.kernel.org Subject: [PATCH v2 2/2] ppp_generic: handle non-linear skbs when passing them to pppd References: <4BDF2FD5.2030509@simon.arlott.org.uk> In-Reply-To: <4BDF2FD5.2030509@simon.arlott.org.uk> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- drivers/net/ppp_generic.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 75e8903..8518a2e 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, DECLARE_WAITQUEUE(wait, current); ssize_t ret; struct sk_buff *skb = NULL; + struct iovec iov; ret = count; @@ -448,7 +449,9 @@ static ssize_t ppp_read(struct file *file, char __user *buf, if (skb->len > count) goto outf; ret = -EFAULT; - if (copy_to_user(buf, skb->data, skb->len)) + iov.iov_base = buf; + iov.iov_len = count; + if (skb_copy_datagram_iovec(skb, 0, &iov, skb->len)) goto outf; ret = skb->len;