linux-stable/drivers/sh
Johannes Weiner 6d75f366b9 lib: radix-tree: check accounting of existing slot replacement users
The bug in khugepaged fixed earlier in this series shows that radix tree
slot replacement is fragile; and it will become more so when not only
NULL<->!NULL transitions need to be caught but transitions from and to
exceptional entries as well.  We need checks.

Re-implement radix_tree_replace_slot() on top of the sanity-checked
__radix_tree_replace().  This requires existing callers to also pass the
radix tree root, but it'll warn us when somebody replaces slots with
contents that need proper accounting (transitions between NULL entries,
real entries, exceptional entries) and where a replacement through the
slot pointer would corrupt the radix tree node counts.

Link: http://lkml.kernel.org/r/20161117193021.GB23430@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Suggested-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Matthew Wilcox <mawilcox@linuxonhyperv.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-12-12 18:55:08 -08:00
..
clk drivers: sh: clk: Avoid crashes when passing NULL clocks 2015-11-24 11:49:18 +09:00
intc lib: radix-tree: check accounting of existing slot replacement users 2016-12-12 18:55:08 -08:00
maple
superhyway drivers: Initialize resource entry to zero 2016-01-30 09:49:58 +01:00
Kconfig sh-pfc: Move driver from drivers/sh/ to drivers/pinctrl/ 2013-01-25 09:24:25 +09:00
Makefile sh: intc: Confine SH_INTC to platforms that need it 2014-08-22 12:28:16 +09:00
pm_runtime.c drivers: sh: Stop using the legacy clock domain on ARM 2016-05-30 09:41:11 +09:00