VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Matthew Wilcox <mawilcox@microsoft.com> 2018-05-25 14:47:24 -0700 committer: Linus Torvalds <torvalds@linux-foundation.org> 2018-05-25 18:12:10 -0700 commit: 7a4deea1aa8bddfed4ef1b35fc2b6732563d8ad5 parent: 3373de209cb123462954740f41c324d03ecfb6d0
Commit Summary:
idr: fix invalid ptr dereference on item delete
Diffstat:
1 file changed, 3 insertions, 1 deletion
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 43e0cbedc3a0..a9e41aed6de4 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -2034,10 +2034,12 @@ void *radix_tree_delete_item(struct radix_tree_root *root,
 			     unsigned long index, void *item)
 {
 	struct radix_tree_node *node = NULL;
-	void __rcu **slot;
+	void __rcu **slot = NULL;
 	void *entry;
 
 	entry = __radix_tree_lookup(root, index, &node, &slot);
+	if (!slot)
+		return NULL;
 	if (!entry && (!is_idr(root) || node_tag_get(root, node, IDR_FREE,
 						get_slot_offset(node, slot))))
 		return NULL;