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: <c81b43b7-e993-4e9f-ad27-acacd0b85847@huawei.com>
Date: Sat, 12 Apr 2025 11:18:03 +0800
From: "liwei (JK)" <liwei728@...wei.com>
To: Su Hui <suhui@...china.com>
CC: <linux-kernel@...r.kernel.org>, <make24@...as.ac.cn>,
	<bhelgaas@...gle.com>, <linux-pci@...r.kernel.org>,
	<bobo.shaobowang@...wei.com>, <wangxiongfeng2@...wei.com>
Subject: Re: [PATCH] Revert "PCI: Fix reference leak in
 pci_register_host_bridge()"



在 2025/4/10 19:19, Su Hui 写道:
> On 2025/4/10 11:28, Xiangwei Li wrote:
>> This reverts commit 804443c1f27883926de94c849d91f5b7d7d696e9.
>>
>> The newly added logic incorrectly sets bus_registered to true even when
>> device_register returns an error, this is incorrect.
>>
>> When device_register fails, there is no need to release the reference 
>> count,
> I think you missed some thing about device_register(). This patch is wrong.
> 
> device_register()
>      -> device_initialize()
>                -> kobject_init()
>                      -> kobject_init_internal()
>                          -> kref_init(&kobj->kref);  //set 
> kref->refcount to 1
>                             ^^^^^^^^^^^^^^^^^^^^^
> 
Sorry, I missed the initialization of refcount in device_initialize,
but I’m confused about the branch logic for bus_registered. Why isn’t
free(bus) executed when bus_registered == true? My understanding is
that the kobject_cleanup operation triggered when refcount reaches zero
does not clean up the allocated bus. Could you clarify this further?

Thanks,
Xiangwei Li
> device_register() only  fails when device_add() fails, and 
> kerf->refcount can be 1
> at this time ,  so we need to call put_deivce() to release  memory.
>> and there are no direct error-handling operations following its 
>> execution.
>>
>> Therefore, this patch is meaningless and should be reverted.
>>
>> Fixes: 804443c1f278 ("PCI: Fix reference leak in 
>> pci_register_host_bridge()")
>> Signed-off-by: Xiangwei Li <liwei728@...wei.com>
>> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@...wei.com>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ