Patch "remoteproc: imx_rproc: Fix refcount mistake in imx_rproc_addr_init" has been added to the 5.15-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

    remoteproc: imx_rproc: Fix refcount mistake in imx_rproc_addr_init

to the 5.15-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:
     remoteproc-imx_rproc-fix-refcount-mistake-in-imx_rpr.patch
and it can be found in the queue-5.15 subdirectory.

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



commit cdad322d19592d7bad837d59f5083dfca421533d
Author: Aleksandr Mishin <amishin@xxxxxxxxxx>
Date:   Wed Jun 12 16:17:14 2024 +0300

    remoteproc: imx_rproc: Fix refcount mistake in imx_rproc_addr_init
    
    [ Upstream commit dce68a49be26abf52712e0ee452a45fa01ab4624 ]
    
    In imx_rproc_addr_init() strcmp() is performed over the node after the
    of_node_put() is performed over it.
    Fix this error by moving of_node_put() calls.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    Fixes: 5e4c1243071d ("remoteproc: imx_rproc: support remote cores booted before Linux Kernel")
    Cc: stable@xxxxxxxxxxxxxxx
    Signed-off-by: Aleksandr Mishin <amishin@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240612131714.12907-1-amishin@xxxxxxxxxx
    Signed-off-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index cfdb96cafc7b9..d5ce97e75f027 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -596,25 +596,29 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
 			continue;
 		}
 		err = of_address_to_resource(node, 0, &res);
-		of_node_put(node);
 		if (err) {
 			dev_err(dev, "unable to resolve memory region\n");
+			of_node_put(node);
 			return err;
 		}
 
-		if (b >= IMX_RPROC_MEM_MAX)
+		if (b >= IMX_RPROC_MEM_MAX) {
+			of_node_put(node);
 			break;
+		}
 
 		/* Not use resource version, because we might share region */
 		priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, res.start, resource_size(&res));
 		if (!priv->mem[b].cpu_addr) {
 			dev_err(dev, "failed to remap %pr\n", &res);
+			of_node_put(node);
 			return -ENOMEM;
 		}
 		priv->mem[b].sys_addr = res.start;
 		priv->mem[b].size = resource_size(&res);
 		if (!strcmp(node->name, "rsc-table"))
 			priv->rsc_table = priv->mem[b].cpu_addr;
+		of_node_put(node);
 		b++;
 	}
 




[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