Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp674538pxu; Wed, 14 Oct 2020 10:43:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOHfC3sKBOPz12jZAgFJpt2kKRizzrKJ4Mz4PbcCOAwubd8jN4M0nlhKImdJFYqQbxsUct X-Received: by 2002:a50:ef0e:: with SMTP id m14mr22107eds.5.1602697396289; Wed, 14 Oct 2020 10:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602697396; cv=none; d=google.com; s=arc-20160816; b=y9X7XcaqbPfeLXBZw9CAWx3h34+kLV53mpp8snLUhJTAlhGtqV2TJQJdrhU44uDdYE mgBFo0RDcvBURaLjYjEm8fVd2dN+64XVZO0eIStPecXR8/dvhAc2eaqg/3+mn4u2rQRu +gcmLslD52zqnkkKCZnpH4/6j/RR9U1QZbkYUmlT3lQHm5vq4oURHmyjpfQ3EnP2vZYH +KWmyA0HPVl+fTeIoM98MIq18ScDtQCEkK8pOK5zfvHwYbpoPfxDMwyJf4L9dY3AYsQr BN89XZwUqekjaGNviWTbMVfxz2GYioxhKWo9UuFyQVT3wgPThM/9FPEvjZ17EIlF0Lnd JBuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=18ljtZA9LSL961+Jz8OU98VYrwx5ZKx4rDJ11xHuE5M=; b=KvU91KwyU9GDhTyoXzC22ttMbFcOS0UJyiP1bwqqSl3/IyjCktQmWHKzGhlo5f2gl8 HR5yAjAVM/BUkYrM+DnjCd7H3fK1tUsoP1X2mAPKtoED6TRA7bIg99l2AZsqJKQ2Khe4 mBMMXRB6FMKRGVWPMCg1dPqYL4rlGqieNpQsGv6zCFs6zs0tI3UNSwHXQm5Nn81tEImE /e80C+gjeUbDz9AK3zZGqi1T6TEgcP6On0YBfMYQSn1dsCyhQPXRBqBwrvtCI+CvaHgy wfvrq3Vwc6pJ6fbT7Z+Ii90fUSdrt205Yq9ZTLkfye4N5ouOMVo6joMLAvU9KraVZp3+ apkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Ayxl6no/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f13si127391edc.249.2020.10.14.10.42.53; Wed, 14 Oct 2020 10:43:16 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Ayxl6no/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389261AbgJNQyO (ORCPT + 99 others); Wed, 14 Oct 2020 12:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbgJNQyO (ORCPT ); Wed, 14 Oct 2020 12:54:14 -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 0CC8AC061755; Wed, 14 Oct 2020 09:54:14 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id 33so119141edq.13; Wed, 14 Oct 2020 09:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=18ljtZA9LSL961+Jz8OU98VYrwx5ZKx4rDJ11xHuE5M=; b=Ayxl6no/cB2pj2f7wXzDu7PpFz508hG4beG9/mGHc+34nxikbgoyw2cxTrd+ti2jkA fCrA9DOcL96Oru1L3TTDo15t0bSfr/eZH97rvNWURimCYmC8/Cgu3rZQ+BsD0SJbo8xf 4rkA/cIHM6+WGCH3J46gR+6IwdORahryiTU4BrRP7DzXojru7vV5noQ4SlTVnkXSS7xP DzYLwu4vwJtCLQNUXOYaxZo7Pq7vSoeZuamLiIzMUWMJQBXyMxNIfN3YbZZPqTQk7caa nyH7U6iC/Oud9UqSwnIigxM4a2IGA5/1OSzxdCMTjKqrDv+wwfafgkR5bLV+B6oonq0M diJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=18ljtZA9LSL961+Jz8OU98VYrwx5ZKx4rDJ11xHuE5M=; b=aI6MC2UeHyHJEAbi6OJel7C+c6Jkb018ziM21AU0Wk1gJkxv3oJtyKxtZ7Tya0sVTF RkitQRfD+bpEa0ZIUMR4ePOGolfEfsFx8PzH5SfGfDEC8BjXk5N0BjOdNSLSkJVoiUoP t/r4hD1+UllNvCymMrQw2DIxxo75sAbWoxB43PkiMl0yYKYLd0VTMVc206kTPU2BXPcq rxQ68PycsNFGiyCwfzcPh/r2zUUgRIqdsK6IAWm6/j5JododV9zXj8jvJ2aUTKevRaig kK1+KN0bhO0rVA2CVWlfRsaGdPItL4OCipYPtZjLSDoE01LSFdi3uI8XJpiEB+Lp9xx8 hegA== X-Gm-Message-State: AOAM532L+NOcesVQaXVyCrWEw2wRhtVEa4czA/2HWZdKaSmvFRTWTonK UFSxmlZtHnN/nw9v1V8QACc= X-Received: by 2002:a05:6402:b31:: with SMTP id bo17mr6497575edb.342.1602694452768; Wed, 14 Oct 2020 09:54:12 -0700 (PDT) Received: from skbuf ([188.26.174.215]) by smtp.gmail.com with ESMTPSA id ce14sm61389edb.25.2020.10.14.09.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 09:54:12 -0700 (PDT) Date: Wed, 14 Oct 2020 19:54:10 +0300 From: Vladimir Oltean To: Christian Eggers Cc: Woojung Huh , Andrew Lunn , Vivien Didelot , Florian Fainelli , Microchip Linux Driver Support , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kurt Kanzenbach Subject: Re: [PATCH net] net: dsa: ksz: fix padding size of skb Message-ID: <20201014165410.fzvzdk3odsdjljpq@skbuf> References: <20201014161719.30289-1-ceggers@arri.de> <20201014164750.qelb6vssiubadslj@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201014164750.qelb6vssiubadslj@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Otherwise, skb->len + padlen == skb->len. Otherwise said, the frame must be padded to max(skb->len, ETH_ZLEN) + tail tag length. So please keep the "skb->len + padlen + len". Thanks, -Vladimir