From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61C89C282C8 for ; Mon, 28 Jan 2019 06:15:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B0572148E for ; Mon, 28 Jan 2019 06:15:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="iMWTc1x8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbfA1GPX (ORCPT ); Mon, 28 Jan 2019 01:15:23 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:42840 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbfA1GPX (ORCPT ); Mon, 28 Jan 2019 01:15:23 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0S69dvg175847; Mon, 28 Jan 2019 06:15:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=QfKZgElSfROS/P+9LWVLYptHl3alriCuxxxVlqSI37M=; b=iMWTc1x8T0MmsjB1aj7fIVf8eS7exF8hzQH21Nsth+h+qyO5sgcHK+nGfoPiZBmExiSE WscuAxpFqT/iQBSpmYfBc49XBinFmyCh8OkRpiBxUTF8iZMwpex8y7wka7HBH+PC+9PH CmZsDfasQM+lfL0TmIxIlILPGewgpQkfIUHz9pxgtxzvzYTlz2NfsJ/XKIgLtPfyFAOQ N1uvpAkBDeSwQVLEZx66uwEBdFMaCeDEANJc8ZaeNRqRhJxFWGmwFfGFK/CMAo2nQXGF 8DSEPbwqX6DPUmCcdk1GST/vtVh8L061mnqNbJz0NXyrz8oXNm3gD9hc08AOlkHKIwln 5g== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2q8eyu45y3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Jan 2019 06:15:18 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0S6FHZw017421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Jan 2019 06:15:18 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x0S6FHco013272; Mon, 28 Jan 2019 06:15:17 GMT Received: from [10.182.69.163] (/10.182.69.163) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 27 Jan 2019 22:15:17 -0800 Subject: Re: [PATCH net-next v2] net: l2tp: fix reading optional fields of L2TPv3 To: Guillaume Nault Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com References: <20190124074917.31173-1-jian.w.wen@oracle.com> <20190124160107.GA6470@localhost.localdomain> From: Jacob Wen Message-ID: Date: Mon, 28 Jan 2019 14:15:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190124160107.GA6470@localhost.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9149 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=802 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901280051 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 1/25/19 12:01 AM, Guillaume Nault wrote: > On Thu, Jan 24, 2019 at 03:49:17PM +0800, Jacob Wen wrote: >> Use pskb_may_pull() to make sure the optional fields are in skb linear >> parts, so we can safely read them later. >> >> It's easy to reproduce the issue with a net driver that supports paged >> skb data. Just create a L2TPv3 over IP tunnel and then generates some >> network traffic. >> Once reproduced, rx err in /sys/kernel/debug/l2tp/tunnels will increase. >> >> Signed-off-by: Jacob Wen >> --- >> Changes in v2: >> 1. Only fix L2TPv3 to make code simple. >> To fix both L2TPv3 and L2TPv2, we'd better refactor l2tp_recv_common. >> It's complicated to do so. >> > Yes, the L2TP data path definitely needs some care. But for a one-off > patch like this, it'd probably make more sense to respect the current > code structure instead of adding yet more special cases. Agree. I didn't give l2tp_udp_recv_core enough attention. > I mean, l2tp_recv_common() assumes that it can safely access the L2TP > header: pskb_may_pull() is done in l2tp_udp_recv_core() (which probably > should pull more bytes in case the length field is present BTW). Yes. Two more bytes are required for L2TPv2. > It's up to l2tp_ip (and l2tp_ip6) to respect this requirement, so that's > where pskb_may_pull() should be done. Yes it'd be better to linearise > data close to the place we access them, but that'd be long term > refactoring. If we don't have the resources to do that, let's just, at > least keep some consistency. I will send a new patch. Thanks. -- Jacob