Commit d7519392 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dan Williams

dm: fix alloc_dax error handling in alloc_dev

Make sure ->dax_dev is NULL on error so that the cleanup path doesn't
trip over an ERR_PTR.
Reported-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211129102203.2243509-2-hch@lst.deSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 83762cb5
......@@ -1786,8 +1786,10 @@ static struct mapped_device *alloc_dev(int minor)
if (IS_ENABLED(CONFIG_DAX_DRIVER)) {
md->dax_dev = alloc_dax(md, md->disk->disk_name,
&dm_dax_ops, 0);
if (IS_ERR(md->dax_dev))
if (IS_ERR(md->dax_dev)) {
md->dax_dev = NULL;
goto bad;
}
}
format_dev_t(md->name, MKDEV(_major, minor));
......
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