lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220511151431.780120-4-vladimir.oltean@nxp.com>
Date:   Wed, 11 May 2022 18:14:29 +0300
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     netdev@...r.kernel.org
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>
Subject: [PATCH net-next 3/5] net: dsa: tag_brcm: __skb_put_padto() can never fail

One of the purposes of the central dsa_realloc_skb() is to ensure that
the skb has a geometry which does not need to be adjusted by tagging
protocol drivers for most cases. This includes making sure that the skb
is not cloned (otherwise pskb_expand_head() is called).

So there is no reason why __skb_put_padto() is going to return an error,
otherwise it would have returned the error in dsa_realloc_skb().

Use the simple eth_skb_pad() which passes "true" to "free_on_error"
(which does not matter) and save a conditional in the TX data path.

Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
 net/dsa/tag_brcm.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index 6cc4c4859a41..c2610d34386d 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -90,11 +90,8 @@ static struct sk_buff *brcm_tag_xmit_ll(struct sk_buff *skb,
 	 * need to make sure that packets are at least 68 bytes
 	 * (including FCS and tag) because the length verification is done after
 	 * the Broadcom tag is stripped off the ingress packet.
-	 *
-	 * Let dsa_slave_xmit() free the SKB
 	 */
-	if (__skb_put_padto(skb, ETH_ZLEN, false))
-		return NULL;
+	eth_skb_pad(skb);
 
 	skb_push(skb, BRCM_TAG_LEN);
 
@@ -220,11 +217,8 @@ static struct sk_buff *brcm_leg_tag_xmit(struct sk_buff *skb,
 	 * need to make sure that packets are at least 70 bytes
 	 * (including FCS and tag) because the length verification is done after
 	 * the Broadcom tag is stripped off the ingress packet.
-	 *
-	 * Let dsa_slave_xmit() free the SKB
 	 */
-	if (__skb_put_padto(skb, ETH_ZLEN, false))
-		return NULL;
+	eth_skb_pad(skb);
 
 	skb_push(skb, BRCM_LEG_TAG_LEN);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ