[dm-devel] Patch "dm: fix alloc_dax error handling in alloc_dev" has been added to the 5.10-stable tree

Sasha Levin sashal at kernel.org
Sun Jan 23 16:13:13 UTC 2022


This is a note to let you know that I've just added the patch titled

    dm: fix alloc_dax error handling in alloc_dev

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     dm-fix-alloc_dax-error-handling-in-alloc_dev.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable at vger.kernel.org> know about it.



commit 3fa2203e31bd62360d4c7214b578d281bc6d49a7
Author: Christoph Hellwig <hch at lst.de>
Date:   Mon Nov 29 11:21:35 2021 +0100

    dm: fix alloc_dax error handling in alloc_dev
    
    [ Upstream commit d751939235b9b7bc4af15f90a3e99288a8b844a7 ]
    
    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 at intel.com>
    Signed-off-by: Christoph Hellwig <hch at lst.de>
    Link: https://lore.kernel.org/r/20211129102203.2243509-2-hch@lst.de
    Signed-off-by: Dan Williams <dan.j.williams at intel.com>
    Signed-off-by: Sasha Levin <sashal at kernel.org>

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 19a70f434029b..6030cba5b0382 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -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);





More information about the dm-devel mailing list