Skip to contentSkip to conversation

ath9k_htc: rare leak in ath9k_hif_usb_alloc_tx_urbs()

PATCH New Dan Carpenter 2 participants 2 messages May 14, 2010 – May 18, 2010 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ath9k_htc: rare leak in ath9k_hif_usb_alloc_tx_urbs()

This is obviously a small picky thing. The original error handling code doesn't free the most recent allocations which haven't been added to the hif_dev->tx.tx_buf list yet.

drivers/net/wireless/ath/ath9k/hif_usb.c +4 -0
index 46dc41a..77b3591 100644
@@ -607,6 +609,10 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)
 
 	return 0;
 err:
+	if (tx_buf) {
+		kfree(tx_buf->buf);
+		kfree(tx_buf);
+	}
 	ath9k_hif_usb_dealloc_tx_urbs(hif_dev);
 	return -ENOMEM;
 }
#1 lore raw

PATCH 2/2 ath9k_htc: rare leak in ath9k_hif_usb_alloc_tx_urbs()

Quoted 5 lines · Dan Carpenter

This is obviously a small picky thing. The original error handling code doesn't free the most recent allocations which haven't been added to the hif_dev->tx.tx_buf list yet.

Thanks.

Quoted 15 lines
drivers/net/wireless/ath/ath9k/hif_usb.c +4 -0
index 46dc41a..77b3591 100644
@@ -607,6 +609,10 @@ static int ath9k_hif_usb_alloc_tx_urbs(struct hif_device_usb *hif_dev)
 
 	return 0;
 err:
+	if (tx_buf) {
+		kfree(tx_buf->buf);
+		kfree(tx_buf);
+	}
 	ath9k_hif_usb_dealloc_tx_urbs(hif_dev);
 	return -ENOMEM;
 }