summaryrefslogtreecommitdiffstats
path: root/lib/xarray.c
diff options
context:
space:
mode:
authorMatthew Wilcox2019-02-21 23:36:45 +0100
committerMatthew Wilcox2019-02-21 23:36:45 +0100
commit2fbe967b3eb7466f679307b38564b8271c093241 (patch)
treed5e97862217a0a89e538f073c7b66483438c2cca /lib/xarray.c
parentXArray: Use xa_cmpxchg to implement xa_reserve (diff)
downloadkernel-qcow2-linux-2fbe967b3eb7466f679307b38564b8271c093241.tar.gz
kernel-qcow2-linux-2fbe967b3eb7466f679307b38564b8271c093241.tar.xz
kernel-qcow2-linux-2fbe967b3eb7466f679307b38564b8271c093241.zip
XArray: Fix xa_erase of 2-byte aligned entries
xas_store() was interpreting the entry it found in the array as a node entry if the bottom two bits had value 2. That's only true if either the entry is in the root node or in a non-leaf node. Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'lib/xarray.c')
-rw-r--r--lib/xarray.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/xarray.c b/lib/xarray.c
index 3f10198f00b7..2cc3798672f7 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -800,7 +800,7 @@ void *xas_store(struct xa_state *xas, void *entry)
* entry is set to NULL.
*/
rcu_assign_pointer(*slot, entry);
- if (xa_is_node(next))
+ if (xa_is_node(next) && (!node || node->shift))
xas_free_nodes(xas, xa_to_node(next));
if (!node)
break;