summary refs log tree commit diff
path: root/lib/xarray.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2019-02-21 17:36:45 -0500
committerMatthew Wilcox <willy@infradead.org>2019-02-21 17:36:45 -0500
commit2fbe967b3eb7466f679307b38564b8271c093241 (patch)
treed5e97862217a0a89e538f073c7b66483438c2cca /lib/xarray.c
parent962033d55d0761e0716a01a715c6659c8c8dfc41 (diff)
downloadlinux-2fbe967b3eb7466f679307b38564b8271c093241.tar.gz
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;