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: <1fbdf0d8-d8c5-4616-ab49-bda4112771e8@redhat.com>
Date:   Thu, 9 Nov 2023 12:33:25 +0100
From:   Marco Pagani <marpagan@...hat.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Xu Yilun <yilun.xu@...ux.intel.com>
Cc:     Moritz Fischer <mdf@...nel.org>, Wu Hao <hao.wu@...el.com>,
        Xu Yilun <yilun.xu@...el.com>, Tom Rix <trix@...hat.com>,
        Alan Tull <atull@...nsource.altera.com>,
        linux-fpga@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] fpga: remove module reference counting from core
 components



On 2023-11-08 17:20, Greg Kroah-Hartman wrote:
> On Wed, Nov 08, 2023 at 11:52:52PM +0800, Xu Yilun wrote:
>>>>>
>>>>> In fpga_region_get() / fpga_region_put(): call get_device() before
>>>>> acquiring the mutex and put_device() after having released the mutex
>>>>> to avoid races.
> 
> Why do you need another reference count with a lock?  You already have
> that with the calls to get/put_device().
>

My understanding is that the lock is there not for reference counting
but to prevent concurrent reprogramming of the region by in-kernel API
consumers.

>>>> Could you help elaborate more about the race?
>>>>
>>>
>>> I accidentally misused the word race. My concern was that memory might
>>> be released after the last put_device(), causing mutex_unlock() to be
>>> called on a mutex that does not exist anymore. It should not happen
>>> for the moment since the region does not use devres, but I think it
>>> still makes the code more brittle.
>>
>> It makes sense.
>>

Thanks,
Marco

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ