From: Roger Quadros <roger.quadros@nokia.com>
To: ext Michal Nazarewicz <mina86@mina86.com>
Cc: <gregkh@suse.de>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/5] usb: gadget: f_mass_storage: Fix potential memory leak
Date: Tue, 5 Apr 2011 20:47:44 +0300 [thread overview]
Message-ID: <4D9B55C0.8040200@nokia.com> (raw)
In-Reply-To: <op.vtg2p4fl3l0zgt@mnazarewicz-glaptop>
On 04/05/2011 06:59 PM, ext Michal Nazarewicz wrote:
> On Tue, 05 Apr 2011 17:36:41 +0200, Roger Quadros
> <roger.quadros@nokia.com> wrote:
>
>> If allocation of multiple buffers would fail then we would leak memory.
>> Fix that.
>>
>> Signed-off-by: Roger Quadros <roger.quadros@nokia.com>
>> ---
>> drivers/usb/gadget/f_mass_storage.c | 6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/f_mass_storage.c
>> b/drivers/usb/gadget/f_mass_storage.c
>> index f6bd001..60b4df9 100644
>> --- a/drivers/usb/gadget/f_mass_storage.c
>> +++ b/drivers/usb/gadget/f_mass_storage.c
>> @@ -2863,6 +2863,12 @@ buffhds_first_it:
>> bh->buf = kmalloc(FSG_BUFLEN, GFP_KERNEL);
>> if (unlikely(!bh->buf)) {
>> rc = -ENOMEM;
>> + /* clean up */
>> + while (i < FSG_NUM_BUFFERS) {
>> + bh--;
>> + kfree(bh->buf);
>> + i++;
>> + }
>> goto error_release;
>> }
>> } while (--i);
>
> This is handled in fsg_common_release(), isn't it? Feel free to
> send a patch with a comment explaining that.
>
Yes it is. This patch is not required.
--
regards,
-roger
next prev parent reply other threads:[~2011-04-05 17:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 15:36 [PATCH 0/5] fixes for f_mass_storage Roger Quadros
2011-04-05 15:36 ` [PATCH 1/5] usb: gadget: f_mass_storage: Fix Bulk-only RESET handling Roger Quadros
2011-04-05 16:09 ` Michal Nazarewicz
2011-04-05 15:36 ` [PATCH 2/5] usb: gadget: f_mass_storage: If 'ro'/'cdrom' specified, open file as read-only Roger Quadros
2011-04-05 16:04 ` Michal Nazarewicz
2011-04-05 15:36 ` [PATCH 3/5] usb: gadget: f_mass_storage: Prevent NULL pointer dereference Roger Quadros
2011-04-05 15:56 ` Michal Nazarewicz
2011-04-05 17:47 ` Roger Quadros
2011-04-05 15:36 ` [PATCH 4/5] usb: gadget: f_mass_storage: Fix potential memory leak Roger Quadros
2011-04-05 15:59 ` Michal Nazarewicz
2011-04-05 17:47 ` Roger Quadros [this message]
2011-04-05 15:36 ` [PATCH 5/5] usb: gadget: f_mass_storage: remove unnecessary initialization Roger Quadros
2011-04-05 16:01 ` Michal Nazarewicz
2011-04-05 16:10 ` [PATCH 0/5] fixes for f_mass_storage Michal Nazarewicz
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=4D9B55C0.8040200@nokia.com \
--to=roger.quadros@nokia.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mina86@mina86.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 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.