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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 5 Apr 2011 20:47:13 +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 3/5] usb: gadget: f_mass_storage: Prevent NULL pointer
 dereference

On 04/05/2011 06:56 PM, ext Michal Nazarewicz wrote:
> On Tue, 05 Apr 2011 17:36:40 +0200, Roger Quadros
> <roger.quadros@...ia.com> wrote:
>> Prevent a NULL pointer dereference in fsg_config_from_params() if
>> 'file' parameter is not specified.
> 
> Have you observed this behaviour?  I don't see how it could happen with
> module parameters and if it appears in some gadget it's a bug in the

It can happen if the gadget that uses f_mass_storage specifies
file_count=1 and doesn't specify a file name.

> gadget.  Not that I'm saying checking for null pointer is a bad idea.

OK. let's do that then.

> 
>> Signed-off-by: Roger Quadros <roger.quadros@...ia.com>
>> ---
>>  drivers/usb/gadget/f_mass_storage.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/f_mass_storage.c
>> b/drivers/usb/gadget/f_mass_storage.c
>> index 5d7de93..f6bd001 100644
>> --- a/drivers/usb/gadget/f_mass_storage.c
>> +++ b/drivers/usb/gadget/f_mass_storage.c
>> @@ -3177,7 +3177,7 @@ fsg_config_from_params(struct fsg_config *cfg,
>>          lun->removable = /* Removable by default */
>>              params->removable_count <= i || params->removable[i];
>>          lun->filename =
>> -            params->file_count > i && params->file[i][0]
>> +            params->file_count > i && params->file[i]
> 
> You're removing the check if an empty file name has been specified.  It
> should read:
> 
> +            params->file_count > i && params->file[i] &&
> params->file[i][0]

Right.

> 
> And since the line is getting pretty long, maybe convert it to a proper
> “if”.  I'm sure Greg will like that. ;)
> 
>>              ? params->file[i]
>>              : 0;
>>      }
> 
ok.

-- 
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