Skip to contentSkip to conversation

sh_eth.c: EDMAC descriptor leak

PATCH New Yoshinori Sato 2 participants 2 messages May 16, 2011 – Jul 27, 2011 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh_eth.c: EDMAC descriptor leak

Hi,

I found memory leak in sh_eth.c.
sh_eth_desc_init call for many times in network problem. And it every time allocate new descriptor. So leak old descriptor.

I will fix this patch.

drivers/net/sh_eth.c +6 -0
index 17dd0d2..f805785 100644
@@ -313,6 +313,9 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth)
 	struct sh_eth_info *port_info = &eth->port_info[port];
 	struct tx_desc_s *cur_tx_desc;
 
+	if (port_info->tx_desc_malloc)
+		/* Already allocated. re-using it */
+		return 0;
 	/*
 	 * Allocate tx descriptors. They must be TX_DESC_SIZE bytes aligned
 	 */
@@ -365,6 +368,9 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth)
 	u32 tmp_addr;
 	u8 *rx_buf;
 
+	if (port_info->rx_desc_malloc)
+		/* Already allocated. re-using it */
+		return 0;
 	/*
 	 * Allocate rx descriptors. They must be RX_DESC_SIZE bytes aligned
 	 */
Signature · 2 lines
Yoshinori Sato
<[email protected]>
#1 lore raw

PATCH 1/1 sh_eth.c: EDMAC descriptor leak

Dear Yoshinori Sato,

drivers/net/sh_eth.c

Quoted 10 lines · In message <87vcxbp69w.wl%[email protected]> you wrote:

Hi,

I found memory leak in sh_eth.c.
sh_eth_desc_init call for many times in network problem. And it every time allocate new descriptor. So leak old descriptor.

I will fix this patch.

drivers/net/sh_eth.c +0 -0
index 17dd0d2..f805785 100644

Can you please resubmit this with your Signed-off-by: line added? Please see http://www.denx.de/wiki/U-Boot/Patches for additional help how to create and submit patches.

Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If the facts don't fit the theory, change the facts.
                                                   -- Albert Einstein