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, 1 Apr 2014 17:17:55 +0900
From:	DaeSeok Youn <daeseok.youn@...il.com>
To:	Jan Beulich <JBeulich@...e.com>
Cc:	konrad.wilk@...cle.com, david.vrabel@...rix.com,
	xen-devel@...ts.xenproject.org, boris.ostrovsky@...cle.com,
	Joe Perches <joe@...ches.com>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [Xen-devel] [PATCH] xen: fix memory leak in __xen_pcibk_add_pci_dev()

2014-04-01 16:23 GMT+09:00 Jan Beulich <JBeulich@...e.com>:
>>>> On 31.03.14 at 12:08, <daeseok.youn@...il.com> wrote:
>
>> It need to free dev_entry when it failed to assign to a new
>> slot on the virtual PCI bus.
>>
>> smatch says:
>>  drivers/xen/xen-pciback/vpci.c:142 __xen_pcibk_add_pci_dev() warn:
>> possible memory leak of 'dev_entry'
>>
>> Signed-off-by: Daeseok Youn <daeseok.youn@...il.com>
>
> Reviewed-by: Jan Beulich <jbeulich@...e.com>
>
> albeit the solution is not ideal:
>
>> --- a/drivers/xen/xen-pciback/vpci.c
>> +++ b/drivers/xen/xen-pciback/vpci.c
>> @@ -130,6 +130,7 @@ static int __xen_pcibk_add_pci_dev(struct
>> xen_pcibk_device *pdev,
>>       err = -ENOMEM;
>>       xenbus_dev_fatal(pdev->xdev, err,
>>                        "No more space on root virtual PCI bus");
>> +     kfree(dev_entry);
>>
>>  unlock:
>>       mutex_unlock(&vpci_dev->lock);
>
> The kfree() invocation would better be placed outside the locked
> region (e.g. in an else to the "if (!err)" a little further down).

You're right.
I will change my patch as your comment and send it again.

Thanks for review.
Daeseok Youn

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