Patch "of: property: decrement node refcount in of_fwnode_get_reference_args()" has been added to the 4.19-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

    of: property: decrement node refcount in of_fwnode_get_reference_args()

to the 4.19-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:
     of-property-decrement-node-refcount-in-of_fwnode_get.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 3fcfc04b30201a937cec535bc89c1dc8622ca264
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Mon Nov 21 10:32:09 2022 +0800

    of: property: decrement node refcount in of_fwnode_get_reference_args()
    
    [ Upstream commit 60d865bd5a9b15a3961eb1c08bd4155682a3c81e ]
    
    In of_fwnode_get_reference_args(), the refcount of of_args.np has
    been incremented in the case of successful return from
    of_parse_phandle_with_args() or of_parse_phandle_with_fixed_args().
    
    Decrement the refcount if of_args is not returned to the caller of
    of_fwnode_get_reference_args().
    
    Fixes: 3e3119d3088f ("device property: Introduce fwnode_property_get_reference_args")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Reviewed-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
    Reviewed-by: Frank Rowand <frowand.list@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20221121023209.3909759-1-yangyingliang@xxxxxxxxxx
    Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 43720c2de138..13c7e55f5cba 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -918,8 +918,10 @@ of_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
 						       nargs, index, &of_args);
 	if (ret < 0)
 		return ret;
-	if (!args)
+	if (!args) {
+		of_node_put(of_args.np);
 		return 0;
+	}
 
 	args->nargs = of_args.args_count;
 	args->fwnode = of_fwnode_handle(of_args.np);



[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