On 03.08.2023 18:31, Daniel P. Smith wrote:
> On 8/3/23 11:56, Jan Beulich wrote:
>> On 03.08.2023 14:56, Daniel P. Smith wrote:
>>> On 8/2/23 07:01, Jan Beulich wrote:
>>>> On 01.08.2023 18:06, Daniel P. Smith wrote:
>>>>> +        {
>>>>> +            for_each_domain(next)
>>>>
>>>> What guarantees that the list won't change behind your back? You don't
>>>> hold domlist_read_lock here afaict. It might be that you're safe because
>>>> that lock is an RCU one and this function is only invoked at init time
>>>> or from some form of interrupt handler. But that's far from obvious and
>>>> will hence need both properly confirming and stating in a comment. (It
>>>> is actually this concern, iirc, which so far had us avoid iterating the
>>>> domain list here.)
>>>
>>> It is better to error on the side of caution instead of assuming this
>>> will always be invoked in a safe manner. I will add a read lock for the
>>> domain list.
>>
>> I'm not firm enough in RCU to be certain whether acquiring that lock is
>> permissible here.
> 
> Same and I took your statements to suggest that I should.

Actually I wasn't paying close enough attention here: The code already
uses rcu_lock_domain_by_id(), which acquires domlist_read_lock.

Jan

Reply via email to