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-next>] [day] [month] [year] [list]
Message-ID: <20170422104656.jjnooh3or4x3lbw3@mwanda>
Date:   Sat, 22 Apr 2017 13:46:56 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Kazuya Mizuguchi <kazuya.mizuguchi.ks@...esas.com>,
        Simon Horman <horms+renesas@...ge.net.au>,
        Yoshihiro Kaneko <ykaneko0929@...il.com>,
        Masaru Nagai <masaru.nagai.vx@...esas.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Niklas Söderlund 
        <niklas.soderlund+renesas@...natech.se>,
        Philippe Reynes <tremyfr@...il.com>, netdev@...r.kernel.org,
        linux-renesas-soc@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH net] ravb: Double free on error in ravb_start_xmit()

If skb_put_padto() fails then it frees the skb.  I shifted that code
up a bit to make my error handling a little simpler.

Fixes: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 8cfc4a54f2dc..3cd7989c007d 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1516,11 +1516,12 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 		spin_unlock_irqrestore(&priv->lock, flags);
 		return NETDEV_TX_BUSY;
 	}
-	entry = priv->cur_tx[q] % (priv->num_tx_ring[q] * NUM_TX_DESC);
-	priv->tx_skb[q][entry / NUM_TX_DESC] = skb;
 
 	if (skb_put_padto(skb, ETH_ZLEN))
-		goto drop;
+		goto exit;
+
+	entry = priv->cur_tx[q] % (priv->num_tx_ring[q] * NUM_TX_DESC);
+	priv->tx_skb[q][entry / NUM_TX_DESC] = skb;
 
 	buffer = PTR_ALIGN(priv->tx_align[q], DPTR_ALIGN) +
 		 entry / NUM_TX_DESC * DPTR_ALIGN;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ