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.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 ECAAEC433E7 for ; Fri, 16 Oct 2020 14:00:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9366420874 for ; Fri, 16 Oct 2020 14:00:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408465AbgJPOAz (ORCPT ); Fri, 16 Oct 2020 10:00:55 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:59758 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408452AbgJPOAy (ORCPT ); Fri, 16 Oct 2020 10:00:54 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kTQHc-001zYk-OT; Fri, 16 Oct 2020 16:00:36 +0200 Date: Fri, 16 Oct 2020 16:00:36 +0200 From: Andrew Lunn To: Christian Eggers Cc: Woojung Huh , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Microchip Linux Driver Support , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: dsa: ksz: don't pad a cloned sk_buff Message-ID: <20201016140036.GC456889@lunn.ch> References: <20201016073527.5087-1-ceggers@arri.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201016073527.5087-1-ceggers@arri.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 16, 2020 at 09:35:27AM +0200, Christian Eggers wrote: > If the supplied sk_buff is cloned (e.g. in dsa_skb_tx_timestamp()), > __skb_put_padto() will allocate a new sk_buff with size = skb->len + > padlen. So the condition just tested for (skb_tailroom(skb) >= padlen + > len) is not fulfilled anymore. Although the real size will usually be > larger than skb->len + padlen (due to alignment), there is no guarantee > that the required memory for the tail tag will be available > > Instead of letting __skb_put_padto allocate a new (too small) sk_buff, > lets take the already existing path and allocate a new sk_buff ourself > (with sufficient size). Hi Christian What is not clear to me is why not change the __skb_put_padto() call to pass the correct length? Andrew