XArray: Fix xa_find_after with multi-index entries
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sat, 18 Jan 2020 03:00:41 +0000 (22:00 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 15:45:26 +0000 (16:45 +0100)
commitdb38561288b75082b5e839decaa15ed253bd2298
treef986cdc830dd72656d192e2c6ed1ef3743ecc659
parenta5135ca1f92a7b201b7f8297f42b8579f92bc55d
XArray: Fix xa_find_after with multi-index entries

commit 19c30f4dd0923ef191f35c652ee4058e91e89056 upstream.

If the entry is of an order which is a multiple of XA_CHUNK_SIZE,
the current detection of sibling entries does not work.  Factor out
an xas_sibling() function to make xa_find_after() a little more
understandable, and write a new implementation that doesn't suffer from
the same bug.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/test_xarray.c
lib/xarray.c