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]
Message-ID: <CAM3j68oNeb5HVYVHTSnQoiBHa7T4krkiDLy0dQkBZUd5BQgo2w@mail.gmail.com>
Date:	Fri, 18 Jan 2013 22:05:45 +0100
From:	Cong Ding <dinggnu@...il.com>
To:	"Hans J. Koch" <hjk@...sjkoch.de>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/1] uio.c: solve memory leak

On Tue, Dec 11, 2012 at 2:21 AM, Hans J. Koch <hjk@...sjkoch.de> wrote:
> On Thu, Nov 29, 2012 at 05:40:00PM +0000, Cong Ding wrote:
>> In version 1, I forgot to modify the same bug in the first loop.
>>
>> we have to call kobject_put() to clean up the kobject after function
>> kobject_init(), kobject_add(), or kobject_uevent() is called.
>>
>> Signed-off-by: Cong Ding <dinggnu@...il.com>
>
> Signed-off-by: "Hans J. Koch" <hjk@...sjkoch.de>

Hi Greg, is this patch stil in the queue?

- cong

>> ---
>>  drivers/uio/uio.c |   16 ++++++++++------
>>  1 files changed, 10 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
>> index 5110f36..79774d3 100644
>> --- a/drivers/uio/uio.c
>> +++ b/drivers/uio/uio.c
>> @@ -291,10 +291,10 @@ static int uio_dev_add_attributes(struct uio_device *idev)
>>               mem->map = map;
>>               ret = kobject_add(&map->kobj, idev->map_dir, "map%d", mi);
>>               if (ret)
>> -                     goto err_map;
>> +                     goto err_map_kobj;
>>               ret = kobject_uevent(&map->kobj, KOBJ_ADD);
>>               if (ret)
>> -                     goto err_map;
>> +                     goto err_map_kobj;
>>       }
>>
>>       for (pi = 0; pi < MAX_UIO_PORT_REGIONS; pi++) {
>> @@ -317,23 +317,27 @@ static int uio_dev_add_attributes(struct uio_device *idev)
>>               ret = kobject_add(&portio->kobj, idev->portio_dir,
>>                                                       "port%d", pi);
>>               if (ret)
>> -                     goto err_portio;
>> +                     goto err_portio_kobj;
>>               ret = kobject_uevent(&portio->kobj, KOBJ_ADD);
>>               if (ret)
>> -                     goto err_portio;
>> +                     goto err_portio_kobj;
>>       }
>>
>>       return 0;
>>
>>  err_portio:
>> -     for (pi--; pi >= 0; pi--) {
>> +     pi--;
>> +err_portio_kobj:
>> +     for (; pi >= 0; pi--) {
>>               port = &idev->info->port[pi];
>>               portio = port->portio;
>>               kobject_put(&portio->kobj);
>>       }
>>       kobject_put(idev->portio_dir);
>>  err_map:
>> -     for (mi--; mi>=0; mi--) {
>> +     mi--;
>> +err_map_kobj:
>> +     for (; mi >= 0; mi--) {
>>               mem = &idev->info->mem[mi];
>>               map = mem->map;
>>               kobject_put(&map->kobj);
>> --
>> 1.7.4.5
>>
>>
--
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