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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 5 Apr 2011 20:47:44 +0300
From:	Roger Quadros <roger.quadros@...ia.com>
To:	ext Michal Nazarewicz <mina86@...a86.com>
CC:	<gregkh@...e.de>, <linux-usb@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/5] usb: gadget: f_mass_storage: Fix potential memory
 leak

On 04/05/2011 06:59 PM, ext Michal Nazarewicz wrote:
> On Tue, 05 Apr 2011 17:36:41 +0200, Roger Quadros
> <roger.quadros@...ia.com> wrote:
> 
>> If allocation of multiple buffers would fail then we would leak memory.
>> Fix that.
>>
>> Signed-off-by: Roger Quadros <roger.quadros@...ia.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ