mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
dm-writecache: fix a crash if we attempt to use non-dax device
If we specify a non-DAX device as a cache device in the 'P' mode,
dm-writecache crashes on NULL pointer dereference inside dax_synchronous.
Note that this is not a security bug because only root can trigger it.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: a466245803 ("dm writecache: reject asynchronous pmem devices")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-5
This commit is contained in:
parent
c1ab80af0d
commit
b15dc73f60
|
|
@ -2499,6 +2499,11 @@ static int writecache_ctr(struct dm_target *ti, unsigned int argc, char **argv)
|
|||
}
|
||||
|
||||
if (WC_MODE_PMEM(wc)) {
|
||||
if (!wc->ssd_dev->dax_dev) {
|
||||
r = -EOPNOTSUPP;
|
||||
ti->error = "Cache device is not a DAX device";
|
||||
goto bad;
|
||||
}
|
||||
if (!dax_synchronous(wc->ssd_dev->dax_dev)) {
|
||||
r = -EOPNOTSUPP;
|
||||
ti->error = "Asynchronous persistent memory not supported as pmem cache";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user