linux/drivers
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
..
accessibility
acpi Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 12:15:10 -08:00
amba
android ANDROID: binder: Clear binder and cookie when setting handle in flat binder struct 2016-10-24 19:37:48 +02:00
ata libata-scsi: disable SCT Write Same for the moment 2016-12-07 16:29:09 -05:00
atm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-12-06 21:33:19 -05:00
auxdisplay
base devres: add devm_alloc_percpu() 2016-11-15 22:34:25 -05:00
bcma bcma: add Dell Inspiron 3148 2016-11-29 17:35:14 +02:00
block zram: restrict add/remove attributes to root only 2016-12-07 17:10:00 -08:00
bluetooth Bluetooth: btmrvl: drop duplicate header slab.h 2016-12-08 07:44:56 +01:00
bus
cdrom
char Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-11-22 13:27:16 -05:00
clk Two small fixes for MIPI PLLs on sunxi devices and a build fix 2016-11-30 15:15:49 -08:00
clocksource Revert "clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init" 2016-10-20 21:58:58 +02:00
connector
cpufreq sched/x86: Change CONFIG_SCHED_ITMT to CONFIG_SCHED_MC_PRIO 2016-11-30 08:27:08 +01:00
cpuidle
crypto Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-12-10 16:21:55 -05:00
dax device-dax: fix private mapping restriction, permit read-only 2016-12-06 17:42:37 -08:00
dca
devfreq
dio
dma dmaengine: cppi41: More PM runtime fixes 2016-11-17 16:09:23 +05:30
dma-buf
edac x86/RAS: Hide SMCA bank names 2016-11-08 17:10:15 +01:00
eisa
extcon extcon: qcom-spmi-misc: Sync the extcon state on interrupt 2016-10-26 16:04:29 +09:00
firewire Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-11-15 10:54:36 -05:00
firmware efi/libstub: Make efi_random_alloc() allocate below 4 GB on 32-bit 2016-11-25 07:15:23 +01:00
fmc
fpga
gpio gpio: Remove GPIO_DEVRES option 2016-11-16 20:46:32 +01:00
gpu Merge branch 'linus' into locking/core, to pick up fixes 2016-12-11 13:07:13 +01:00
hid HID: hid-sensor-hub: clear memory to avoid random data 2016-11-23 17:54:58 +01:00
hsi net: use core MTU range checking in misc drivers 2016-10-20 14:51:10 -04:00
hv vmbus: make sysfs names consistent with PCI 2016-11-01 09:07:13 -06:00
hwmon hwmon: (core) fix resource leak on devm_kcalloc failure 2016-10-24 06:05:13 -07:00
hwspinlock
hwtracing
i2c Revert "i2c: octeon: thunderx: Limit register access retries" 2016-11-29 20:04:21 +01:00
ide
idle
iio iio: maxim_thermocouple: detect invalid storage size in read() 2016-11-13 10:08:32 +01:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-11-22 13:27:16 -05:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2016-12-01 10:29:41 -08:00
iommu Merge git://git.infradead.org/intel-iommu 2016-11-27 08:24:46 -08:00
ipack ipack: print a hex number after a 0x prefix 2016-10-27 18:43:43 -07:00
irqchip GIC updates for Linux 4.9-rc2 2016-10-21 21:40:29 +02:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-12-10 16:21:55 -05:00
leds
lguest
lightnvm
macintosh
mailbox mailbox: PCC: Fix lockdep warning when request PCC channel 2016-11-14 22:07:38 +01:00
mcb
md Merge tag 'md/4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md 2016-11-05 11:34:07 -07:00
media Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-11-26 23:42:21 -05:00
memory
memstick
message net: use core MTU range checking in misc drivers 2016-10-20 14:51:10 -04:00
mfd mfd: wm8994-core: Don't use managed regulator bulk get API 2016-11-25 11:10:55 +00:00
misc Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 09:09:54 -08:00
mmc mmc: dw_mmc: fix the error handling for dma operation 2016-11-21 11:08:28 +01:00
mtd MTD updates for 4.9-rc4: 2016-11-05 10:52:29 -07:00
net e1000: use disable_hardirq() for e1000_netpoll() 2016-12-10 23:31:19 -05:00
nfc mei: bus: fix received data size check in NFC fixup 2016-10-31 10:25:22 -06:00
ntb ntb_perf: potential info leak in debugfs 2016-11-13 16:48:30 -05:00
nubus
nvdimm acpi, nfit, libnvdimm: fix / harden ars_status output length handling 2016-12-06 16:08:10 -08:00
nvme nvme/pci: Don't free queues on error 2016-11-16 12:39:57 -07:00
nvmem
of of/fdt: mark hotpluggable memory 2016-12-12 18:55:07 -08:00
oprofile
parisc
parport
pci pci-v4.9-fixes-4 2016-12-01 16:44:42 -08:00
pcmcia drivers/pcmcia/m32r_pcc.c: check return from add_pcc_socket 2016-12-12 18:55:06 -08:00
perf
phy phy: twl4030-usb: Fix for musb session bit based PM 2016-11-17 16:25:40 +01:00
pinctrl pinctrl-aspeed-g5: Never set SCU90[6] 2016-11-07 10:31:33 +01:00
platform ACPI fix for v4.9-rc5 2016-11-11 17:02:01 -08:00
pnp
power
powercap
pps
ps3
ptp ptp: Introduce a high resolution frequency adjustment method. 2016-11-09 21:19:53 -05:00
pwm pwm: Fix device reference leak 2016-11-29 16:43:24 +01:00
rapidio mm: replace get_user_pages() write/force parameters with gup_flags 2016-10-19 08:11:43 -07:00
ras
regulator regulator: core: silence warning: "VDD1: ramp_delay not set" 2016-10-28 18:22:40 +01:00
remoteproc
reset reset: uniphier: rename MIO reset to SD reset for Pro5, PXs2, LD20 SoCs 2016-10-22 18:31:42 +09:00
rpmsg
rtc rtc: omap: prevent disabling of clock/module during suspend 2016-11-04 23:11:39 +01:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-10-30 12:42:58 -04:00
sbus
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-12-10 16:21:55 -05:00
sfi
sh lib: radix-tree: check accounting of existing slot replacement users 2016-12-12 18:55:08 -08:00
sn
soc
spi Merge remote-tracking branches 'spi/fix/dt', 'spi/fix/fsl-dspi' and 'spi/fix/fsl-espi' into spi-linus 2016-10-29 12:51:55 -06:00
spmi
ssb ssb: Fix error routine when fallback SPROM fails 2016-11-17 08:49:04 +02:00
staging staging: wilc1000: use reset to set mac header 2016-12-03 15:49:16 -05:00
target cxgb4: Allocate Tx queues dynamically 2016-11-18 14:04:29 -05:00
tc
thermal Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-11-26 23:42:21 -05:00
thunderbolt thunderbolt: Compile on x86 only 2016-11-18 09:42:59 +01:00
tty Three patches for minor issues: 2016-12-12 09:06:38 -08:00
uio
usb Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-11-26 23:42:21 -05:00
uwb uwb: fix device reference leaks 2016-11-01 09:04:04 -06:00
vfio vfio/pci: Fix integer overflows, bitmask check 2016-10-26 13:49:29 -06:00
vhost Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:48:02 -08:00
video Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-12-12 10:03:44 -08:00
virt mm: replace get_user_pages() write/force parameters with gup_flags 2016-10-19 08:11:43 -07:00
virtio virtio_ring: mark vring_dma_dev inline 2016-10-31 00:40:08 +02:00
vlynq
vme vme: vme_get_size potentially returning incorrect value on failure 2016-10-28 08:25:18 -04:00
w1
watchdog Merge branches 'acpi-sleep-fixes' and 'acpi-wdat-fixes' 2016-11-25 22:24:07 +01:00
xen xen: fixes for 4.9-rc2 2016-10-24 19:52:24 -07:00
zorro
Kconfig
Makefile A small bug fix and a new driver for acting as an IPMI device. 2016-10-23 15:56:23 -07:00