Patch "hwmon: (xgene) Fix ioremap and memremap leak" 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

    hwmon: (xgene) Fix ioremap and memremap leak

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:
     hwmon-xgene-fix-ioremap-and-memremap-leak.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 cd7d7436193ab7adfa02e7c86601afdb16532a72
Author: Tianyi Jing <jingfelix@xxxxxxxxxxx>
Date:   Sat Mar 18 22:38:51 2023 +0800

    hwmon: (xgene) Fix ioremap and memremap leak
    
    [ Upstream commit 813cc94c7847ae4a17e9f744fb4dbdf7df6bd732 ]
    
    Smatch reports:
    
    drivers/hwmon/xgene-hwmon.c:757 xgene_hwmon_probe() warn:
    'ctx->pcc_comm_addr' from ioremap() not released on line: 757.
    
    This is because in drivers/hwmon/xgene-hwmon.c:701 xgene_hwmon_probe(),
    ioremap and memremap is not released, which may cause a leak.
    
    To fix this, ioremap and memremap is modified to devm_ioremap and
    devm_memremap.
    
    Signed-off-by: Tianyi Jing <jingfelix@xxxxxxxxxxx>
    Reviewed-by: Dongliang Mu <dzm91@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230318143851.2191625-1-jingfelix@xxxxxxxxxxx
    [groeck: Fixed formatting and subject]
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c
index d1abea49f01be..78d9f52e2a719 100644
--- a/drivers/hwmon/xgene-hwmon.c
+++ b/drivers/hwmon/xgene-hwmon.c
@@ -698,14 +698,14 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
 		ctx->comm_base_addr = pcc_chan->shmem_base_addr;
 		if (ctx->comm_base_addr) {
 			if (version == XGENE_HWMON_V2)
-				ctx->pcc_comm_addr = (void __force *)ioremap(
-							ctx->comm_base_addr,
-							pcc_chan->shmem_size);
+				ctx->pcc_comm_addr = (void __force *)devm_ioremap(&pdev->dev,
+								  ctx->comm_base_addr,
+								  pcc_chan->shmem_size);
 			else
-				ctx->pcc_comm_addr = memremap(
-							ctx->comm_base_addr,
-							pcc_chan->shmem_size,
-							MEMREMAP_WB);
+				ctx->pcc_comm_addr = devm_memremap(&pdev->dev,
+								   ctx->comm_base_addr,
+								   pcc_chan->shmem_size,
+								   MEMREMAP_WB);
 		} else {
 			dev_err(&pdev->dev, "Failed to get PCC comm region\n");
 			rc = -ENODEV;



[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