summaryrefslogtreecommitdiffstats
path: root/lib/maple_tree.c
diff options
context:
space:
mode:
authorLiam R. Howlett <Liam.Howlett@Oracle.com>2023-01-20 11:26:03 -0500
committerAndrew Morton <akpm@linux-foundation.org>2023-02-09 16:51:30 -0800
commit65be6f058b0eba98dc6c6f197ea9f62c9b6a519f (patch)
treef020b5d0d6f69d63c223e9fe047cbaa6179736c0 /lib/maple_tree.c
parente7f43ca99fc8bff2333547bb08dae20a35a23450 (diff)
downloadlinux-stable-65be6f058b0eba98dc6c6f197ea9f62c9b6a519f.tar.gz
linux-stable-65be6f058b0eba98dc6c6f197ea9f62c9b6a519f.tar.bz2
linux-stable-65be6f058b0eba98dc6c6f197ea9f62c9b6a519f.zip
maple_tree: fix potential rcu issue
Ensure the node isn't dead after reading the node end. Link: https://lkml.kernel.org/r/20230120162650.984577-3-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib/maple_tree.c')
-rw-r--r--lib/maple_tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 1c5d3b640a24..7e3cf5b7e68b 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4655,13 +4655,13 @@ static inline void *mas_next_nentry(struct ma_state *mas,
pivots = ma_pivots(node, type);
slots = ma_slots(node, type);
mas->index = mas_safe_min(mas, pivots, mas->offset);
+ count = ma_data_end(node, type, pivots, mas->max);
if (ma_dead_node(node))
return NULL;
if (mas->index > max)
return NULL;
- count = ma_data_end(node, type, pivots, mas->max);
if (mas->offset > count)
return NULL;