Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1327467

[PATCH 2/2] radix-tree: fix oops after radix_tree_iter_retry

From Matthew Wilcox <matthew.r.wilcox@intel.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] radix-tree: fix oops after radix_tree_iter_retry
Date 2016-02-05 04:50 +0100
Message-ID <qYFzb-3aZ-7@gated-at.bofh.it> (permalink)
References <qYFzb-3aZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


After calling radix_tree_iter_retry(), 'slot' will be set to NULL.
This can cause radix_tree_next_slot() to dereference the NULL pointer.
Check for a NULL pointer on entry to radix_tree_next_slot().

Reported-by: Konstantin Khlebnikov <koct9i@gmail.com>
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
---
 include/linux/radix-tree.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 3e488e2..9aa3afe 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -447,6 +447,9 @@ radix_tree_chunk_size(struct radix_tree_iter *iter)
 static __always_inline void **
 radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags)
 {
+	if (!slot)
+		return NULL;
+
 	if (flags & RADIX_TREE_ITER_TAGGED) {
 		iter->tags >>= 1;
 		if (likely(iter->tags & 1ul)) {
-- 
2.7.0.rc3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] Radix tree retry bug fix & test case Matthew Wilcox <matthew.r.wilcox@intel.com> - 2016-02-05 04:50 +0100
  [PATCH 2/2] radix-tree: fix oops after radix_tree_iter_retry Matthew Wilcox <matthew.r.wilcox@intel.com> - 2016-02-05 04:50 +0100
  Re: [PATCH 0/2] Radix tree retry bug fix & test case Konstantin Khlebnikov <koct9i@gmail.com> - 2016-02-05 06:00 +0100

csiph-web