Re: [PATCH 5.15 v3] mm/filemap: fix UAF in find_lock_entries

From: Matthew Wilcox
Date: Wed Jul 06 2022 - 10:09:23 EST


On Wed, Jul 06, 2022 at 03:45:27PM +0800, Liu Shixin wrote:
> rcu_read_lock();
> while ((page = find_get_entry(&xas, end, XA_PRESENT))) {
> + unsigned long next_idx = xas.xa_index;

It's confusing to have next_idx not be the actual next index.
That was why I made it 'xas.xa_index + 1'. I know it's somewhat
used as an indicator that we don't need to call xas_set(), and so
it doesn't really matter, but let's say what we mean.