mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
dm: fix alloc_dax error handling in alloc_dev
[ Upstream commit d751939235 ]
Make sure ->dax_dev is NULL on error so that the cleanup path doesn't
trip over an ERR_PTR.
Reported-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211129102203.2243509-2-hch@lst.de
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2e2086f49e
commit
dfde7afed7
@@ -1894,8 +1894,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;
|
||||
}
|
||||
}
|
||||
|
||||
add_disk_no_queue_reg(md->disk);
|
||||
|
||||
Reference in New Issue
Block a user