From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] sh_eth.c: EDMAC descriptor leak
Date: Mon, 16 May 2011 14:24:11 +0900 [thread overview]
Message-ID: <87vcxbp69w.wl%ysato@users.sourceforge.jp> (raw)
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.
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 17dd0d2..f805785 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -313,6 +313,9 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth)
struct sh_eth_info *port_info = ð->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
*/
--
Yoshinori Sato
<ysato@users.sourceforge.jp>
next reply other threads:[~2011-05-16 5:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-16 5:24 Yoshinori Sato [this message]
2011-07-27 21:19 ` [U-Boot] [PATCH] sh_eth.c: EDMAC descriptor leak Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vcxbp69w.wl%ysato@users.sourceforge.jp \
--to=ysato@users.sourceforge.jp \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.