提交 d7519392 编写于 作者: C Christoph Hellwig 提交者: 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: NDan Williams <dan.j.williams@intel.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211129102203.2243509-2-hch@lst.deSigned-off-by: NDan Williams <dan.j.williams@intel.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册