Patch "nvme: clear the request_queue pointers on failure in nvme_alloc_admin_tag_set" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

    nvme: clear the request_queue pointers on failure in nvme_alloc_admin_tag_set

to the 6.1-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:
     nvme-clear-the-request_queue-pointers-on-failure-in-.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 61991049c6efd0478896d0e0a2ce02608ee4ca82
Author: Maurizio Lombardi <mlombard@xxxxxxxxxx>
Date:   Fri Jan 27 16:42:37 2023 +0100

    nvme: clear the request_queue pointers on failure in nvme_alloc_admin_tag_set
    
    [ Upstream commit fd62678ab55cb01e11a404d302cdade222bf4022 ]
    
    If nvme_alloc_admin_tag_set() fails, the admin_q and fabrics_q pointers
    are left with an invalid, non-NULL value. Other functions may then check
    the pointers and dereference them, e.g. in
    
      nvme_probe() -> out_disable: -> nvme_dev_remove_admin().
    
    Fix the bug by setting admin_q and fabrics_q to NULL in case of error.
    
    Also use the set variable to free the tag_set as ctrl->admin_tagset isn't
    initialized yet.
    
    Signed-off-by: Maurizio Lombardi <mlombard@xxxxxxxxxx>
    Reviewed-by: Keith Busch <kbusch@xxxxxxxxxx>
    Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 25ade4ce8e0a7..e189ce17deb3e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4881,7 +4881,9 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
 out_cleanup_admin_q:
 	blk_mq_destroy_queue(ctrl->admin_q);
 out_free_tagset:
-	blk_mq_free_tag_set(ctrl->admin_tagset);
+	blk_mq_free_tag_set(set);
+	ctrl->admin_q = NULL;
+	ctrl->fabrics_q = NULL;
 	return ret;
 }
 EXPORT_SYMBOL_GPL(nvme_alloc_admin_tag_set);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux