lkml.org 
[lkml]   [2017]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7 10/10] lib/dlock-list: Fix use-after-unlock problem in dlist_for_each_entry_safe()
From
Date
On 10/30/2017 10:11 AM, Davidlohr Bueso wrote:
> On Fri, 27 Oct 2017, Waiman Long wrote:
>
>> The dlist_for_each_entry_safe() macro in include/linux/dlock-list has
>> a use-after-unlock problem where racing condition can happen because
>> of a lack of spinlock protection. Fortunately, this macro is not
>> currently being used in the kernel.
>>
>> This patch changes the dlist_for_each_entry_safe() macro so that the
>> call to __dlock_list_next_list() is deferred until the next entry is
>> being used. That should eliminate the use-after-unlock problem.
>>
>> Reported-by: Boqun Feng <boqun.feng@gmail.com>
>> Signed-off-by: Waiman Long <longman@redhat.com>
>
> Reviewed-by: Davidlohr Bueso <dbueso@suse.de>
>
> But would it not be better to merge this patch (among others) into 1/N?
> Specifically the newer patches 7-10 should be in the original dlock
> implementation instead of adding fixes to incorrect code in the original
> commit. Also less of a pita for backporting.
>
> Thanks,
> Davidlohr +191,17 @@ extern void dlock_list_add(struct dlock_list_node
> *node,

Yes, that is true. I will send out a new version with all the fixes
integrated later this week.

Cheers,
Longman

\
 
 \ /
  Last update: 2017-10-30 15:16    [W:0.114 / U:24.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site