Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp673195pxu; Wed, 14 Oct 2020 10:41:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQQ0zxrsWp0Ngl44Zixk9wtGmHalJ3smfoMkwDwZZNVqqd0HkznxABTm6NUTd2pqoiwGiH X-Received: by 2002:a17:906:6683:: with SMTP id z3mr123883ejo.303.1602697277674; Wed, 14 Oct 2020 10:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602697277; cv=none; d=google.com; s=arc-20160816; b=SHM9YwVLhgwFGpHSNX6Nf0nswK05/2D3yjy3ocd0Cm8alqbQDVqI7LzZp20tGzoeCN qpqGWfD1yFcyBvHyEpAOGsLelBWB6lO0T0UqR6gXBL81o20BFgcHPq8JYEXvXQOAbfVW 65oKEqW6QOOw8KEK5RpRYY/gRIp++O84oh+2xTsPzE5tu2NaBviweS0LKDzpkHDIUett OUKtgvcbfsYdmJhyigreJlI0XrGh0YnUwVErG3EjlESvoyZQM1R1jZGhxC072dur2/uA oWZ2Z2ozbomsKCn4sUVmQi51su8Nm8g0ktHfWJvBrG9ejxr1eb/EOwvFCBhIRdXYYZ6X v4ZA== 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 :message-id:date:subject:cc:to:from; bh=2kRVE7aA7j1/c/3r4aLBX9eYHvybONW2KDw6AtUBaT8=; b=b2JyiUIaR8LcVXyA8QhVRjdDAvu53O5FSkG/UGtPi94lf8QcQG5guARsT0b8Tuh2RH x0q0RqsEDkDikMQmGY+snpI0du9QP2lpsTNX0bd9Bz2bvd3CRvY6UctaMPf/l7tSIgzz DMUqtvvOHq0aFo9mEfFm+i72It2cL5RfV6ySqDXb06xgqSemmdtcKRHMtruJ9p3p0sJ/ cfW/34ygaMkV83oAtQMmdVOubSLXQUh9EgOSgrvxGvED10Nhxbh2RqMjh1SiidUaZ2+x 1Jnh6l9J+yiVhVZqz6valEqOSu06EtynU5SzF5J8lM1zxQJr6BJKYD486/tC1m4IhSpI T9OA== 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 ca20si106377edb.402.2020.10.14.10.40.55; Wed, 14 Oct 2020 10:41:17 -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 S1731857AbgJNQSO (ORCPT + 99 others); Wed, 14 Oct 2020 12:18:14 -0400 Received: from mailout04.rmx.de ([94.199.90.94]:37669 "EHLO mailout04.rmx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731840AbgJNQSO (ORCPT ); Wed, 14 Oct 2020 12:18:14 -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 mailout04.rmx.de (Postfix) with ESMTPS id 4CBHdZ2sXGz3qtkv; Wed, 14 Oct 2020 18:18:10 +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 4CBHcn4nwJz2TTL4; Wed, 14 Oct 2020 18:17:29 +0200 (CEST) Received: from N95HX1G2.wgnetz.xx (192.168.54.83) by mta.arri.de (192.168.100.104) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 14 Oct 2020 18:17:29 +0200 From: Christian Eggers To: Woojung Huh , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean CC: Microchip Linux Driver Support , "David S . Miller" , Jakub Kicinski , , , Christian Eggers Subject: [PATCH net] net: dsa: ksz: fix padding size of skb Date: Wed, 14 Oct 2020 18:17:19 +0200 Message-ID: <20201014161719.30289-1-ceggers@arri.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.54.83] X-RMX-ID: 20201014-181729-4CBHcn4nwJz2TTL4-0@kdin02 X-RMX-SOURCE: 217.111.95.66 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __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 --- net/dsa/tag_ksz.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index 945a9bd5ba35..8ef2085349e7 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -24,7 +24,7 @@ static struct sk_buff *ksz_common_xmit(struct sk_buff *skb, if (skb_tailroom(skb) >= padlen + len) { /* Let dsa_slave_xmit() free skb */ - if (__skb_put_padto(skb, skb->len + padlen, false)) + if (__skb_put_padto(skb, ETH_ZLEN + len, false)) return NULL; nskb = skb; @@ -45,7 +45,7 @@ static struct sk_buff *ksz_common_xmit(struct sk_buff *skb, /* Let skb_put_padto() free nskb, and let dsa_slave_xmit() free * skb */ - if (skb_put_padto(nskb, nskb->len + padlen)) + if (skb_put_padto(nskb, ETH_ZLEN + len)) return NULL; consume_skb(skb); -- Christian Eggers Embedded software developer Arnold & Richter Cine Technik GmbH & Co. Betriebs KG Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRA 57918 Persoenlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRB 54477 Geschaeftsfuehrer: Dr. Michael Neuhaeuser; Stephan Schenk; Walter Trauninger; Markus Zeiler