[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0fc66521-2a5f-1dc3-bd37-784a1435c7a8@redhat.com>
Date: Mon, 30 Oct 2017 10:15:04 -0400
From: Waiman Long <longman@...hat.com>
To: Davidlohr Bueso <dave@...olabs.net>
Cc: Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.com>,
Jeff Layton <jlayton@...chiereds.net>,
"J. Bruce Fields" <bfields@...ldses.org>,
Tejun Heo <tj@...nel.org>,
Christoph Lameter <cl@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Andi Kleen <andi@...stfloor.org>,
Dave Chinner <dchinner@...hat.com>,
Boqun Feng <boqun.feng@...il.com>
Subject: Re: [PATCH v7 10/10] lib/dlock-list: Fix use-after-unlock problem in
dlist_for_each_entry_safe()
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@...il.com>
>> Signed-off-by: Waiman Long <longman@...hat.com>
>
> Reviewed-by: Davidlohr Bueso <dbueso@...e.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
Powered by blists - more mailing lists