Search Linux Wireless

[PATCH 14/35] Fix incorrect queue management in at76_tx_mgmt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The old pending buffer should be freed, not the new one.  No need to set
txbuf to NULL.

Signed-off-by: Pavel Roskin <proski@xxxxxxx>
---

 drivers/net/wireless/at76_usb.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index f49fb3d..cabef24 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -1600,7 +1600,7 @@ static void at76_tx_callback(struct urb *urb)
 static int at76_tx_mgmt(struct at76_priv *priv, struct at76_tx_buffer *txbuf)
 {
 	unsigned long flags;
-	int ret = 0;
+	int ret;
 	int urb_status;
 	void *oldbuf = NULL;
 
@@ -1611,9 +1611,9 @@ static int at76_tx_mgmt(struct at76_priv *priv, struct at76_tx_buffer *txbuf)
 
 	urb_status = priv->tx_urb->status;
 	if (urb_status == -EINPROGRESS) {
-		oldbuf = priv->next_mgmt_bulk;	/* to kfree below */
+		/* cannot transmit now, put in the queue */
+		oldbuf = priv->next_mgmt_bulk;
 		priv->next_mgmt_bulk = txbuf;
-		txbuf = NULL;
 	}
 	spin_unlock_irqrestore(&priv->mgmt_spinlock, flags);
 
@@ -1621,15 +1621,12 @@ static int at76_tx_mgmt(struct at76_priv *priv, struct at76_tx_buffer *txbuf)
 		/* a data/mgmt tx is already pending in the URB -
 		   if this is no error in some situations we must
 		   implement a queue or silently modify the old msg */
-		err("%s: %s removed pending mgmt buffer %s",
-		    priv->netdev->name, __func__,
-		    hex2str(priv->next_mgmt_bulk, 64));
-		kfree(priv->next_mgmt_bulk);
+		err("%s: %s removed pending mgmt buffer %s", priv->netdev->name,
+		    __func__, hex2str(oldbuf, 64));
+		kfree(oldbuf);
+		return 0;
 	}
 
-	if (!txbuf)
-		return ret;
-
 	txbuf->tx_rate = 0;
 	txbuf->padding = at76_calc_padding(le16_to_cpu(txbuf->wlength));
 
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux