Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1327465 > unrolled thread
| Started by | Matthew Wilcox <matthew.r.wilcox@intel.com> |
|---|---|
| First post | 2016-02-05 04:50 +0100 |
| Last post | 2016-02-05 06:00 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[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
| From | Matthew Wilcox <matthew.r.wilcox@intel.com> |
|---|---|
| Date | 2016-02-05 04:50 +0100 |
| Subject | [PATCH 0/2] Radix tree retry bug fix & test case |
| Message-ID | <qYFzb-3aZ-3@gated-at.bofh.it> |
Konstantin pointed out my braino when using radix_tree_iter_retry(), and then pointed out a second braino. I think we can fix both brainos with one simple test (the advantage of having your braino pointed out to you is that you know what you were expecting to happen, so you can sometimes propose simlpy making happen what you expected to happen. Konstantin doesn't have access to my though tprocesses.) Kontantin wrote a really great test ... and then didn't add it to the test suite. That made me sad, so I added it. Andrew, can you drop radix-tree-fix-oops-after-radix_tree_iter_retry.patch from your tree and add these two patches instead? If you prefer Konstantin's fix to this one, I'll send you another patch to fix the second problem Konstantin pointed out. I was a bit unsure about the proper attribution here. The essentials of the test-suite change from Konstantin are unchanged, but he didn't have his own sign-off on it. So I made him 'From' and only added my own sign-off. Konstantin Khlebnikov (1): radix-tree tests: Add regression3 test Matthew Wilcox (1): radix-tree: fix oops after radix_tree_iter_retry include/linux/radix-tree.h | 3 ++ tools/testing/radix-tree/Makefile | 2 +- tools/testing/radix-tree/linux/kernel.h | 1 + tools/testing/radix-tree/main.c | 1 + tools/testing/radix-tree/regression.h | 1 + tools/testing/radix-tree/regression3.c | 86 +++++++++++++++++++++++++++++++++ 6 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 tools/testing/radix-tree/regression3.c -- 2.7.0.rc3
[toc] | [next] | [standalone]
| From | Matthew Wilcox <matthew.r.wilcox@intel.com> |
|---|---|
| Date | 2016-02-05 04:50 +0100 |
| Subject | [PATCH 2/2] radix-tree: fix oops after radix_tree_iter_retry |
| Message-ID | <qYFzb-3aZ-7@gated-at.bofh.it> |
| In reply to | #1327465 |
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
[toc] | [prev] | [next] | [standalone]
| From | Konstantin Khlebnikov <koct9i@gmail.com> |
|---|---|
| Date | 2016-02-05 06:00 +0100 |
| Message-ID | <qYGEW-3Sl-5@gated-at.bofh.it> |
| In reply to | #1327465 |
On Fri, Feb 5, 2016 at 6:40 AM, Matthew Wilcox <matthew.r.wilcox@intel.com> wrote: > Konstantin pointed out my braino when using radix_tree_iter_retry(), > and then pointed out a second braino. I think we can fix both brainos > with one simple test (the advantage of having your braino pointed out > to you is that you know what you were expecting to happen, so you can > sometimes propose simlpy making happen what you expected to happen. > Konstantin doesn't have access to my though tprocesses.) > > Kontantin wrote a really great test ... and then didn't add it to the > test suite. That made me sad, so I added it. I haven't seen them, I wasn't in CC. And I prefer testing in vivo if possible. > > Andrew, can you drop radix-tree-fix-oops-after-radix_tree_iter_retry.patch > from your tree and add these two patches instead? If you prefer > Konstantin's fix to this one, I'll send you another patch to fix the > second problem Konstantin pointed out. Nak. Mine version generates better code. radix_tree_next_slot is a hot place. Please fix second problem in your helper separately. > > I was a bit unsure about the proper attribution here. The essentials > of the test-suite change from Konstantin are unchanged, but he didn't > have his own sign-off on it. So I made him 'From' and only added my > own sign-off. > > Konstantin Khlebnikov (1): > radix-tree tests: Add regression3 test > > Matthew Wilcox (1): > radix-tree: fix oops after radix_tree_iter_retry > > include/linux/radix-tree.h | 3 ++ > tools/testing/radix-tree/Makefile | 2 +- > tools/testing/radix-tree/linux/kernel.h | 1 + > tools/testing/radix-tree/main.c | 1 + > tools/testing/radix-tree/regression.h | 1 + > tools/testing/radix-tree/regression3.c | 86 +++++++++++++++++++++++++++++++++ > 6 files changed, 93 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/radix-tree/regression3.c > > -- > 2.7.0.rc3 >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web