Patch "nvme-hwmon: Return error code when registration fails" has been added to the 5.10-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-hwmon: Return error code when registration fails

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:
     nvme-hwmon-return-error-code-when-registration-fails.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@xxxxxxxxxxxxxxx> know about it.



commit 9b1decb3ed2711a2dbb96720490578f9a9d6f236
Author: Daniel Wagner <dwagner@xxxxxxx>
Date:   Fri Feb 12 10:30:15 2021 +0100

    nvme-hwmon: Return error code when registration fails
    
    [ Upstream commit 78570f8873c8cd44c12714c7fa7db2601ec5617d ]
    
    The hwmon pointer wont be NULL if the registration fails. Though the
    exit code path will assign it to ctrl->hwmon_device. Later
    nvme_hwmon_exit() will try to free the invalid pointer. Avoid this by
    returning the error code from hwmon_device_register_with_info().
    
    Fixes: ed7770f66286 ("nvme/hwmon: rework to avoid devm allocation")
    Signed-off-by: Daniel Wagner <dwagner@xxxxxxx>
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Stable-dep-of: c94b7f9bab22 ("nvme-hwmon: kmalloc the NVME SMART log buffer")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c
index 8f9e96986780..0a586d712920 100644
--- a/drivers/nvme/host/hwmon.c
+++ b/drivers/nvme/host/hwmon.c
@@ -248,6 +248,7 @@ int nvme_hwmon_init(struct nvme_ctrl *ctrl)
 	if (IS_ERR(hwmon)) {
 		dev_warn(dev, "Failed to instantiate hwmon device\n");
 		kfree(data);
+		return PTR_ERR(hwmon);
 	}
 	ctrl->hwmon_device = hwmon;
 	return 0;



[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