lightnvm: pblk: fix race on sysfs line state
authorJavier González <javier@cnexlabs.com>
Tue, 9 Oct 2018 11:12:07 +0000 (13:12 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:08:21 +0000 (11:08 -0800)
commitbd206a06a712f2c345940595f53d49a14386f6cf
tree48aa4c32a7d2615b2844e3fdaf78d329fbda8eb7
parent5764ffc8a643add918a977cee0e945d57bd0563d
lightnvm: pblk: fix race on sysfs line state

[ Upstream commit 44cdbdc657b23f75736eca3e88b781f009104363 ]

pblk exposes a sysfs interface that represents its internal state. Part
of this state is the map bitmap for the current open line, which should
be protected by the line lock to avoid a race when freeing the line
metadata. Currently, it is not.

This patch makes sure that the line state is consistent and NULL
bitmap pointers are not dereferenced.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/lightnvm/pblk-core.c
drivers/lightnvm/pblk-sysfs.c