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>] [day] [month] [year] [list]
Date:	Sun, 18 Aug 2013 16:09:30 +0800
From:	Wei Yongjun <weiyj.lk@...il.com>
To:	grant.likely@...aro.org, rob.herring@...xeda.com,
	davem@...emloft.net, jonas.jensen@...il.com
Cc:	yongjun_wei@...ndmicro.com.cn, netdev@...r.kernel.org,
	devicetree@...r.kernel.org
Subject: [PATCH -next] moxa: fix missing unlock on error in moxart_mac_start_xmit()

From: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>

Add the missing unlock before return from function moxart_mac_start_xmit()
in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
---
 drivers/net/ethernet/moxa/moxart_ether.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
index abd2c54..6eee686 100644
--- a/drivers/net/ethernet/moxa/moxart_ether.c
+++ b/drivers/net/ethernet/moxa/moxart_ether.c
@@ -314,6 +314,7 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	unsigned int len;
 	unsigned int tx_head = priv->tx_head;
 	u32 txdes1;
+	int ret = NETDEV_TX_BUSY;
 
 	desc = priv->tx_desc_base + (TX_REG_DESC_SIZE * tx_head);
 
@@ -321,7 +322,7 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	if (readl(desc + TX_REG_OFFSET_DESC0) & TX_DESC0_DMA_OWN) {
 		net_dbg_ratelimited("no TX space for packet\n");
 		priv->stats.tx_dropped++;
-		return NETDEV_TX_BUSY;
+		goto out_unlock;
 	}
 
 	len = skb->len > TX_BUF_SIZE ? TX_BUF_SIZE : skb->len;
@@ -330,7 +331,7 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 						   len, DMA_TO_DEVICE);
 	if (dma_mapping_error(&ndev->dev, priv->tx_mapping[tx_head])) {
 		netdev_err(ndev, "DMA mapping error\n");
-		return NETDEV_TX_BUSY;
+		goto out_unlock;
 	}
 
 	priv->tx_len[tx_head] = len;
@@ -360,10 +361,11 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	priv->tx_head = TX_NEXT(tx_head);
 
 	ndev->trans_start = jiffies;
-
+	ret = NETDEV_TX_OK;
+out_unlock:
 	spin_unlock_irq(&priv->txlock);
 
-	return NETDEV_TX_OK;
+	return ret;
 }
 
 static struct net_device_stats *moxart_mac_get_stats(struct net_device *ndev)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ