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,INCLUDES_PATCH, MAILING_LIST_MULTI,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 2EA3BC282D4 for ; Wed, 30 Jan 2019 07:06:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB46A2085B for ; Wed, 30 Jan 2019 07:06:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="ies6nSKs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbfA3HGR (ORCPT ); Wed, 30 Jan 2019 02:06:17 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:46602 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfA3HGR (ORCPT ); Wed, 30 Jan 2019 02:06:17 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0U73qwd082237; Wed, 30 Jan 2019 07:06:13 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=wxVHdd8/Rl1ubVuA+3PSczFfoHpzQ0esdD3FyMwlDyw=; b=ies6nSKs5bbWWULm0C2E/Msv21KKD9wqujJU70Bg9XukllDoIknk1JNa2xYNUGlLq4mg 1lLegFXIfQ7Dy0JB8NKp4wKmWcFkgPna7hF24Lh7TAZ0iaqt0v/563lWrsit/b67HFP2 WCvEKlcP0rLWAIsthe+38WJqaG8ZQfEZByMVyL9VPfs0zDCf5xRTOfJZTjJ0cOvRq2aW 9RQHKx9kH6zJNAhAwV5n6ORY3T9i+vErJsZ+FDBzYSWpNb517VAKuZJNhQDZa1Z27seD qBs27H3YhT1aawol/L/nBHR8XFZ29qiy1v+aBFEMW6HsEaqnYB2y9AOnLQjI7KawufNT YA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2q8g6r8nj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jan 2019 07:06:13 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x0U767XZ032478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jan 2019 07:06:08 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x0U767dV016823; Wed, 30 Jan 2019 07:06:07 GMT Received: from [10.182.69.163] (/10.182.69.163) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 29 Jan 2019 23:06:07 -0800 Subject: Re: [PATCH net v3] net: l2tp: fix reading optional fields of L2TPv3 To: Guillaume Nault Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com References: <20190129061813.8097-1-jian.w.wen@oracle.com> <20190129223727.GA4062@linux.home> From: Jacob Wen Message-ID: <2712b823-1bf7-fd95-12ff-e9c254d95352@oracle.com> Date: Wed, 30 Jan 2019 15:06:04 +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: <20190129223727.GA4062@linux.home> 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=9151 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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901300054 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Thanks for the detailed review. On 1/30/19 6:37 AM, Guillaume Nault wrote: > On Tue, Jan 29, 2019 at 02:18:13PM +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 in l2tp_recv_common. >> > Looks fine to me. Just a few nitpicks. Not sure if they're worth a repost. > But if you send a v4, you can: > * Add the proper Fixes tag. > * Drop 'net:' from the subsystem prefix ('l2tp:' is enough). > * Move your patch history inside the commit description. > * Keep my Acked-by tag. Done in v4. >> diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c >> index 26f1d435696a..82c28008b438 100644 >> --- a/net/l2tp/l2tp_core.c >> +++ b/net/l2tp/l2tp_core.c >> @@ -884,6 +884,10 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb) >> goto error; >> } >> >> + if (tunnel->version != L2TP_HDR_VER_2 && >> > Using tunnel->version == L2TP_HDR_VER_3 would have been clearer. Ditto. > >> diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h >> index 9c9afe94d389..870f8ccf95f7 100644 >> --- a/net/l2tp/l2tp_core.h >> +++ b/net/l2tp/l2tp_core.h >> @@ -301,6 +301,27 @@ static inline bool l2tp_tunnel_uses_xfrm(const struct l2tp_tunnel *tunnel) >> } >> #endif >> >> +/* Pull optional fields of L2TPv3 */ >> +static inline int l2tp_v3_pull_opt(struct l2tp_session *session, struct sk_buff *skb, >> > The comment and function name are a bit misleading: nothing is pulled > here. > You are right. The misleading is inherited from pskb_may_pull. s/l2tp_v3_pull_opt/l2tp_v3_ensure_opt_in_linear/ in v4. > > BTW, Do you plan to also fix L2TPv2? > It looks like defining L2TP_HDR_SIZE_MAX to 14 (size of L2TPv2 header > with all optional fields) and using it in place of L2TP_HDR_SIZE_SEQ in > l2tp_udp_recv_core() should be enough. I will do that with your Suggested-by. Thanks. -- Jacob