Commit 5348deb1 authored by Pankaj Gupta's avatar Pankaj Gupta Committed by Mike Snitzer

dm table: fix dax_dev NULL dereference in device_synchronous()

If a device doesn't support DAX its 'dax_dev' is NULL.  Fix
device_synchronous() to first check if dax_dev is NULL before
dereferencing it.

Fixes: 2e9ee095 ("dm: enable synchronous dax")
Reported-by: jencce.kernel@gmail.com
Signed-off-by: default avatarPankaj Gupta <pagupta@redhat.com>
Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 609488bc
......@@ -894,7 +894,7 @@ int device_supports_dax(struct dm_target *ti, struct dm_dev *dev,
static int device_synchronous(struct dm_target *ti, struct dm_dev *dev,
sector_t start, sector_t len, void *data)
{
return dax_synchronous(dev->dax_dev);
return dev->dax_dev && dax_synchronous(dev->dax_dev);
}
bool dm_table_supports_dax(struct dm_table *t,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment