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=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 F3799C388F9 for ; Fri, 30 Oct 2020 21:20:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A2E3C221FA for ; Fri, 30 Oct 2020 21:20:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qwneroql" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727806AbgJ3VUu (ORCPT ); Fri, 30 Oct 2020 17:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727791AbgJ3VUt (ORCPT ); Fri, 30 Oct 2020 17:20:49 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10BCFC0613CF; Fri, 30 Oct 2020 14:20:48 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id a71so2731416edf.9; Fri, 30 Oct 2020 14:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZKTu+SyOym00jlZmBEEbyAXxFoTFInAe8yTP8rWjHtk=; b=qwneroqlmVG8apuxqKIq+QFIdLS1j1wzEsu/in6YQ11niQ1HNGYk/EWPkTrce2aL6u S7O540UNT36IIfhg5aSfbyf1gIuRCxIyxTO99d/ZUCT9Y414TYRHzTeNgZ1D8tTlJbSm 4PbDvZfY1GhIQaH8yp5IwHJey7nKQAS+oDA9ps/INCSSjutTC65Z/6/F198cGAUEXoky hwRH5mYevuCCsbQnI8JQCnkHvZ2hDAh+JdYmgmqbbofP5vpNbTp3LYex1i191aGw5nNC cPSXM20HyyIxpARZ2HKFj2tXn1qBl+Gtq8pnnCgWGblfFZiuYrYElNhUBCFgi4tEB7C2 ZVZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZKTu+SyOym00jlZmBEEbyAXxFoTFInAe8yTP8rWjHtk=; b=RNoWs04aQHSu+FdxFKv1VVZ0m+u+psoQV2+ZmacaE9/DRaZ8i5YcZQl0xpqODRjB2+ x/P0R54sbfo98pHgAHiLj2LXJtHmqz32Dxx+iZwL10NhdDI63QHqVdga4TsA58oHfsbE DgZKEOTIrbQaWSjvbHCXwTPMITC8KluH7X9CT2z3Vh+9QqUozPHSnV0h2mJaaBnHR2sS Mbv6dvgVsJXlwAN50AKnOKsSjbdFSJZw8aZk8TZa+KduHKwJhrAK4EuK7/jpWIxM4zeg KTzYO8/LUoUFOyDqqCwiPgr9SbSeQ1sx5wJMuCAgcW5EnTCu2ixtFG4F3+gVb38aWJjR mzDA== X-Gm-Message-State: AOAM533btfB74wQ+hJZsiq+39+4Icr+7AzaDMCZfe33CfmD5RNg7lUNA gSlW2rUt2dVOrrbbDXcjakijYIp/Llq6D/8zeVg= X-Google-Smtp-Source: ABdhPJyEZOI8WvfrGv12dvPPgMU6LbgDHWeelJI9PsIWWwPCqTj+ms9mJv6AYBX4hkPHi2jyUXv2VCVfBOAhRxJCQW4= X-Received: by 2002:a50:8adb:: with SMTP id k27mr4471824edk.254.1604092846788; Fri, 30 Oct 2020 14:20:46 -0700 (PDT) MIME-Version: 1.0 References: <20201030022839.438135-1-xie.he.0141@gmail.com> <20201030022839.438135-4-xie.he.0141@gmail.com> In-Reply-To: From: Willem de Bruijn Date: Fri, 30 Oct 2020 17:20:04 -0400 Message-ID: Subject: Re: [PATCH net-next v4 3/5] net: hdlc_fr: Improve the initial checks when we receive an skb To: Xie He Cc: Jakub Kicinski , "David S. Miller" , Network Development , linux-kernel , Krzysztof Halasa Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Oct 30, 2020 at 3:21 PM Xie He wrote: > > On Fri, Oct 30, 2020 at 9:31 AM Willem de Bruijn > wrote: > > > > > Add an fh->ea2 check to the initial checks in fr_rx. fh->ea2 == 1 means > > > the second address byte is the final address byte. We only support the > > > case where the address length is 2 bytes. > > > > Can you elaborate a bit for readers not intimately familiar with the codebase? > > > > Is there something in the following code that has this implicit > > assumption on 2-byte address lengths? > > Yes, the address length must be 2 bytes, otherwise the 3rd and 4th > bytes would not be the control and protocol fields as we assumed in > the code. > > The frame format is specified in RFC 2427 > (https://tools.ietf.org/html/rfc2427). We can see the overall frame > format on Page 3. If the address length is longer than 2 bytes, all > the following fields will be shifted behind. Thanks for that context. If it's not captured in the code, it would be great to include in the commit message. >From a quick scan, RFC 2427 does not appear to actually define the Q.922 address. For that I ended up reading ITU-T doc "Q.922 : ISDN data link layer specification for frame mode bearer services", section 3.2.