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] [day] [month] [year] [list]
Date:	Mon, 2 Jul 2012 14:21:58 +0530
From:	"devendra.aaru" <devendra.aaru@...il.com>
To:	Ian Abbott <abbotti@....co.uk>
Cc:	Ian Abbott <ian.abbott@....co.uk>,
	Mori Hess <fmhess@...rs.sourceforge.net>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	H Hartley Sweeten <hsweeten@...ionengravers.com>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V3 2/2] staging/comedi/drivers: free allocated priv and
 release resources if comedi_alloc_subdevices

On Mon, Jul 2, 2012 at 2:15 PM, Ian Abbott <abbotti@....co.uk> wrote:
> On 2012-07-01 17:20, Devendra Naga wrote:
>>
>> as comedi_alloc_subdevices may fail, we leak out the memory allocated by
>> alloc_private,
>> and also the I/O regions we requested.
>>
>> free out the private data pointer of the driver, and release the I/O
>> regions
>>
>> Signed-off-by: Devendra Naga <devendra.aaru@...il.com>
>> ---
>>   drivers/staging/comedi/drivers/fl512.c |    5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/fl512.c
>> b/drivers/staging/comedi/drivers/fl512.c
>> index 52e6d14..1c372d1 100644
>> --- a/drivers/staging/comedi/drivers/fl512.c
>> +++ b/drivers/staging/comedi/drivers/fl512.c
>> @@ -135,8 +135,11 @@ static int fl512_attach(struct comedi_device *dev,
>> struct comedi_devconfig *it)
>>   #endif
>>
>>         ret = comedi_alloc_subdevices(dev, 2);
>> -       if (ret)
>> +       if (ret) {
>> +               kfree(dev->private);
>> +               release_region(iobase, FL512_SIZE);
>>                 return ret;
>> +       }
>>
>>         /*
>>          * this if the definitions of the supdevices, 2 have been defined
>>
>
> As mentioned in my comment for your PATCH 1/2, this is unneccessary.  In
> fact it will resuly in dev->private being freed twice and the I/O region
> being released twice due to clean-up in the comedi core when fl512_attach()
> returns an error, which will also call fl512_detach() during the clean-up.
>
> --
> -=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@....co.uk>        )=-
> -=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
>
>

Ok, sorry for the heavy noise caused by these patches :(.

anyway i have a question

are you going to remove the alloc_private wapper and use kzalloc?

Thanks,
Devendra.
--
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