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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 6B135C433E7 for ; Wed, 14 Oct 2020 17:03:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B9812222C for ; Wed, 14 Oct 2020 17:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731447AbgJNRDG (ORCPT ); Wed, 14 Oct 2020 13:03:06 -0400 Received: from mailout06.rmx.de ([94.199.90.92]:34745 "EHLO mailout06.rmx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726517AbgJNRDG (ORCPT ); Wed, 14 Oct 2020 13:03:06 -0400 Received: from kdin02.retarus.com (kdin02.dmz1.retloc [172.19.17.49]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout06.rmx.de (Postfix) with ESMTPS id 4CBJdL0RVlz9xXn; Wed, 14 Oct 2020 19:03:02 +0200 (CEST) Received: from mta.arri.de (unknown [217.111.95.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by kdin02.retarus.com (Postfix) with ESMTPS id 4CBJd31FtYz2TTMH; Wed, 14 Oct 2020 19:02:47 +0200 (CEST) Received: from n95hx1g2.localnet (192.168.54.12) by mta.arri.de (192.168.100.104) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 14 Oct 2020 19:02:14 +0200 From: Christian Eggers To: Vladimir Oltean CC: Woojung Huh , Andrew Lunn , Vivien Didelot , Florian Fainelli , Microchip Linux Driver Support , "David S . Miller" , Jakub Kicinski , , , Kurt Kanzenbach Subject: Re: [PATCH net] net: dsa: ksz: fix padding size of skb Date: Wed, 14 Oct 2020 19:02:13 +0200 Message-ID: <3253541.RgjG7ZtOS4@n95hx1g2> Organization: Arnold & Richter Cine Technik GmbH & Co. Betriebs KG In-Reply-To: <20201014165410.fzvzdk3odsdjljpq@skbuf> References: <20201014161719.30289-1-ceggers@arri.de> <20201014164750.qelb6vssiubadslj@skbuf> <20201014165410.fzvzdk3odsdjljpq@skbuf> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Originating-IP: [192.168.54.12] X-RMX-ID: 20201014-190253-4CBJd31FtYz2TTMH-0@kdin02 X-RMX-SOURCE: 217.111.95.66 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Vladimir, On Wednesday, 14 October 2020, 18:54:10 CEST, Vladimir Oltean wrote: > On Wed, Oct 14, 2020 at 07:47:50PM +0300, Vladimir Oltean wrote: > > On Wed, Oct 14, 2020 at 06:17:19PM +0200, Christian Eggers wrote: > > > __skb_put_padto() is called in order to ensure a minimal size of the > > > sk_buff. The required minimal size is ETH_ZLEN + the size required for > > > the tail tag. > > > > > > The current argument misses the size for the tail tag. The expression > > > "skb->len + padlen" can be simplified to ETH_ZLEN. > > > > > > Too small sk_buffs typically result from cloning in > > > dsa_skb_tx_timestamp(). The cloned sk_buff may not meet the minimum size > > > requirements. > > > > > > Fixes: e71cb9e00922 ("net: dsa: ksz: fix skb freeing") > > > Signed-off-by: Christian Eggers > > > --- > > > > Reviewed-by: Vladimir Oltean > > Actually no, I take that back. > > This statement: > > The expression "skb->len + padlen" can be simplified to ETH_ZLEN. > > is false. > skb->len + padlen == ETH_ZLEN only if skb->len is less than ETH_ZLEN. ok, my comment is false. > Otherwise, skb->len + padlen == skb->len. > > Otherwise said, the frame must be padded to > max(skb->len, ETH_ZLEN) + tail tag length. At first I thought the same when working on this. But IMHO the padding must only ensure the minimum required size, there is no need to pad to the "real" size of the skb. The check for the tailroom above ensures that enough memory for the "real" size is available. > So please keep the "skb->len + padlen + len". > > Thanks, > -Vladimir Best regards Christian