[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZfkIKnu_xBQa59b4@casper.infradead.org>
Date: Tue, 19 Mar 2024 03:36:10 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Dmitry Mastykin <dmastykin@...ralinux.ru>
Cc: corbet@....net, linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
thellstrom@...are.com, mastichi@...il.com
Subject: Re: docs: bug in "Krefs and RCU" example
On Mon, Mar 18, 2024 at 02:27:44PM +0300, Dmitry Mastykin wrote:
> Hello all,
> It seems there is a problem in "Krefs and RCU" example, that may cause
> a crash.
> I marked the place between two problem lines with "problem is here" comment.
> If list_del_rcu() will be called between these lines, and list will become
> empty, then q.next will not point to a valid struct my_data.
> entry->refcount will also be invalid.
> Instead, q.next must be read first, and then compared with q to check
> list's emptiness (for example like in list_for_each_entry_rcu macro).
I agree you've identified a problem, but there's no way we should apply
this patch that adds "problem is here"! Instead we should show the
proper usage, which is a call to list_first_or_null_rcu().
Powered by blists - more mailing lists