aboutsummaryrefslogtreecommitdiff
path: root/arch/parisc/kernel/process.c
diff options
context:
space:
mode:
authorDan Williams <[email protected]>2021-02-01 16:20:40 -0800
committerDan Williams <[email protected]>2021-02-01 16:20:40 -0800
commit7018c897c2f243d4b5f1b94bc6b4831a7eab80fb (patch)
tree6383c6bcef1c705d22d3f753d4a3efc32d6150f9 /arch/parisc/kernel/process.c
parent50f558a5fe16b385cf1427b2a96149f4f68952d9 (diff)
libnvdimm/dimm: Avoid race between probe and available_slots_show()
Richard reports that the following test: (while true; do cat /sys/bus/nd/devices/nmem*/available_slots 2>&1 > /dev/null done) & while true; do for i in $(seq 0 4); do echo nmem$i > /sys/bus/nd/drivers/nvdimm/bind done for i in $(seq 0 4); do echo nmem$i > /sys/bus/nd/drivers/nvdimm/unbind done done ...fails with a crash signature like: divide error: 0000 [#1] SMP KASAN PTI RIP: 0010:nd_label_nfree+0x134/0x1a0 [libnvdimm] [..] Call Trace: available_slots_show+0x4e/0x120 [libnvdimm] dev_attr_show+0x42/0x80 ? memset+0x20/0x40 sysfs_kf_seq_show+0x218/0x410 The root cause is that available_slots_show() consults driver-data, but fails to synchronize against device-unbind setting up a TOCTOU race to access uninitialized memory. Validate driver-data under the device-lock. Fixes: 4d88a97aa9e8 ("libnvdimm, nvdimm: dimm driver and base libnvdimm device-driver infrastructure") Cc: <[email protected]> Cc: Vishal Verma <[email protected]> Cc: Dave Jiang <[email protected]> Cc: Ira Weiny <[email protected]> Cc: Coly Li <[email protected]> Reported-by: Richard Palethorpe <[email protected]> Acked-by: Richard Palethorpe <[email protected]> Signed-off-by: Dan Williams <[email protected]>
Diffstat (limited to 'arch/parisc/kernel/process.c')
0 files changed, 0 insertions, 0 deletions