Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp674834pxu; Wed, 14 Oct 2020 10:43:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8vWk/UFQ3DHIPbdMGvJjSpv9BAtuMUwC/c3+DHeo6DcsBC83H0GXvKcRvwM8BVeMi1vc+ X-Received: by 2002:a17:907:43c0:: with SMTP id ok24mr125688ejb.385.1602697422553; Wed, 14 Oct 2020 10:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602697422; cv=none; d=google.com; s=arc-20160816; b=pXg204+6pPJfM6olqsdYoGXRQf0aYAzVLoqLxlgi92z+WkPiTqc6B/4tBVI1jz68hs fLUIVhzlP7hQ4EV3b0ZOeoerncu/hv/OQ9seiyMmbS0WpHBmYCAkK5P/llfdfV3MvgCb rl2aglV0mNBas4A0ECq0A+haO+RO+TeLDzB27ZBNwyGp3P5gEeJoVoxqsYTCVUtizGbE HVFMDR+EPlmWFrEkBEStEZvlWkMTkbOCM8vA78FitS+Nb22nPgD7q/coJ+qtc3E0hN3A yUsLaFEeUC20ZDmWEcPKDRwgNaloaiYdXFLkMG+MGLEi2Bnb637/xuLqcJD6pZtDh/vb 3Kcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from; bh=muaz9eJ7qolJaKl9yd58/+n5rHdTD3j5mh4pf5EskAA=; b=nwxo5ACHYcIAQFoJcGqTYXsvBcN50Ow+nJtjJGPhg7HMsliRUK2Q65CZQQw8WbK0NG Za0W6GIwyBUAYZ9hiNIF3Lc+eneKHfw+qLQJt18IbiaPh+bHNpWnKmSu+tIYzUZQOVYH hIhacMTLtgzJc/Pcmdjtwg7WpdQBznRmjhT1UHQEq9Vwfy0Yk3pe6Hp6s37NHHMDa7QM ljQVqyjTXJzWlXXuVaogvwDgFy426997fKuyzqB8ocjf5y+mHf2hxKcWoMqd2U3GqBVM ACcTCm890rBM2AruD1ZvugAMLU1JISEqzgZMfME+rjeF5wNN73rwT3gUTsTLAM1g9e8J NT6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf16si91487edb.540.2020.10.14.10.43.19; Wed, 14 Oct 2020 10:43:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731437AbgJNRDG (ORCPT + 99 others); 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: linux-kernel@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