[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHZn/IFvZbMX9QTD@zeniv-ca.linux.org.uk>
Date: Wed, 14 Apr 2021 03:56:44 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Gautham Ananthakrishna <gautham.ananthakrishna@...cle.com>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, matthew.wilcox@...cle.com,
khlebnikov@...dex-team.ru
Subject: Re: [PATCH RFC 6/6] dcache: prevent flooding with negative dentries
On Thu, Jan 21, 2021 at 06:49:45PM +0530, Gautham Ananthakrishna wrote:
> + spin_lock(&victim->d_lock);
> + parent = lock_parent(victim);
> +
> + rcu_read_unlock();
Similar story. As soon as you hit that rcu_read_unlock(), the memory
pointed to by victim might be reused. If you have hit __lock_parent(),
victim->d_lock had been dropped and regained. Which means that freeing
might've been already scheduled. Unlike #1/6, here you won't get
memory corruption in lock_parent() itself, but...
> +
> + if (d_count(victim) || !d_is_negative(victim) ||
> + (victim->d_flags & DCACHE_REFERENCED)) {
> + if (parent)
> + spin_unlock(&parent->d_lock);
> + spin_unlock(&victim->d_lock);
... starting from here you just might.
Powered by blists - more mailing lists