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: <1375042113.3669.40.camel@edumazet-glaptop>
Date:	Sun, 28 Jul 2013 13:08:33 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Neil Horman <nhorman@...driver.com>
Cc:	David Miller <davem@...emloft.net>, bhutchings@...arflare.com,
	luis.henriques@...onical.com, netdev@...r.kernel.org,
	jcliburn@...il.com, stable@...r.kernel.org
Subject: Re: [net PATCH] atl1c: Fix misuse of netdev_alloc_skb in refilling
 rx ring

On Sun, 2013-07-28 at 12:21 -0700, Eric Dumazet wrote:

> 
> btw, this driver leaks skb horribly in this error path :
> 
>                 if (rrs->word3 & (RRS_RX_ERR_SUM | RRS_802_3_LEN_ERR)) {
>                         atl1c_clean_rfd(rfd_ring, rrs, rfd_num);
>                                 if (netif_msg_rx_err(adapter))
>                                         dev_warn(&pdev->dev,
>                                                 "wrong packet! rrs word3 is %x\n",
>                                                 rrs->word3);
>                         continue;
>                 }

Possible fix would be :

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 786a874..e815c23 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1729,11 +1729,16 @@ static void atl1c_clean_rfd(struct atl1c_rfd_ring *rfd_ring,
 	u16 i;
 	u16 rfd_index;
 	struct atl1c_buffer *buffer_info = rfd_ring->buffer_info;
+	struct sk_buff *skb;
 
 	rfd_index = (rrs->word0 >> RRS_RX_RFD_INDEX_SHIFT) &
 			RRS_RX_RFD_INDEX_MASK;
 	for (i = 0; i < num; i++) {
-		buffer_info[rfd_index].skb = NULL;
+		skb = buffer_info[rfd_index].skb;
+		if (skb) {
+			kfree_skb(skb);
+			buffer_info[rfd_index].skb = NULL;
+		}
 		ATL1C_SET_BUFFER_STATE(&buffer_info[rfd_index],
 					ATL1C_BUFFER_FREE);
 		if (++rfd_index == rfd_ring->count)
@@ -1793,6 +1798,7 @@ rrs_checked:
 			pci_unmap_single(pdev, buffer_info->dma,
 				buffer_info->length, PCI_DMA_FROMDEVICE);
 			skb = buffer_info->skb;
+			buffer_info->skb = NULL;
 		} else {
 			/* TODO */
 			if (netif_msg_rx_err(adapter))


--
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