From: Ming Lei <tom.leiming@gmail.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
Greg Kroah-Hartman <gregkh@suse.de>,
linux-kernel <linux-kernel@vger.kernel.org>,
David Woodhouse <dwmw2@infradead.org>,
Sachin Sant <sachinp@in.ibm.com>
Subject: Re: Possible memory leak in request_firmware()
Date: Wed, 8 Jul 2009 12:38:05 +0800 [thread overview]
Message-ID: <d82e647a0907072138x106c48bdyfbc4dd884ad64b2c@mail.gmail.com> (raw)
In-Reply-To: <1247003445.5710.7.camel@pc1117.cambridge.arm.com>
[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]
2009/7/8 Catalin Marinas <catalin.marinas@arm.com>:
> On Tue, 2009-07-07 at 19:01 +0200, Cornelia Huck wrote:
>
> There is one more leak in this area which I couldn't figure out where it
> should be freed:
>
> unreferenced object 0xc353e530 (size 512):
> comm "cat", pid 3130, jiffies 4294903232
> backtrace:
> [<c01e6f6a>] create_object+0xfa/0x250
> [<c01e753d>] kmemleak_alloc+0x5d/0x70
> [<c01e223d>] __kmalloc+0x10d/0x210
> [<c03b2d2f>] firmware_data_write+0x1df/0x270
> [<c024163a>] write+0x13a/0x1b0
> [<c01eae1c>] vfs_write+0x9c/0x190
> [<c01eafcd>] sys_write+0x3d/0x70
> [<c010319c>] sysenter_do_call+0x12/0x38
> [<ffffffff>] 0xffffffff
>
> Any idea? It looks like this is the kmalloc() in fw_realloc_buffer()
> (inlined in firmware_data_write).
I guess the leak is introduced in commit :
commit 6e03a201bbe8137487f340d26aa662110e324b20
firmware: speed up request_firmware(), v3
The attachment patch may fix the leak, please test and verify it.
Thanks.
--
Lei Ming
[-- Attachment #2: firmware_class_mem_leak.patch --]
[-- Type: text/x-patch, Size: 441 bytes --]
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 2da4803..271dc6b 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -180,7 +180,6 @@ static ssize_t firmware_loading_store(struct device *dev,
goto err;
}
/* Pages will be freed by vfree() */
- fw_priv->pages = NULL;
fw_priv->page_array_size = 0;
fw_priv->nr_pages = 0;
complete(&fw_priv->completion);
next prev parent reply other threads:[~2009-07-08 4:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-07 15:17 Catalin Marinas
2009-07-07 17:01 ` Cornelia Huck
2009-07-07 21:50 ` Catalin Marinas
2009-07-08 4:38 ` Ming Lei [this message]
2009-07-08 6:28 ` David Woodhouse
2009-07-08 8:42 ` Ming Lei
2009-07-08 8:56 ` David Woodhouse
2009-07-08 0:18 ` Ming Lei
2009-07-10 17:36 ` Greg KH
2009-07-10 22:49 ` Catalin Marinas
2009-07-10 22:56 ` Greg KH
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=d82e647a0907072138x106c48bdyfbc4dd884ad64b2c@mail.gmail.com \
--to=tom.leiming@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dwmw2@infradead.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=sachinp@in.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®