Skip to content

Commit 9fed417

Browse files
committed
device property: Add cleanup.h based fwnode_handle_put() scope based cleanup.
JIRA: https://issues.redhat.com/browse/RHEL-66957 CVE: CVE-2024-50197 commit 59ed5e2 Author: Jonathan Cameron <Jonathan.Cameron@huawei.com> Date: Sat Feb 17 16:42:36 2024 +0000 device property: Add cleanup.h based fwnode_handle_put() scope based cleanup. Useful where the fwnode_handle was obtained from a call such as fwnode_find_reference() as it will safely do nothing if IS_ERR() is true and will automatically release the reference on the variable leaving scope. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Link: https://lore.kernel.org/r/20240217164249.921878-3-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Steve Best <sbest@redhat.com>
1 parent c84085f commit 9fed417

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/linux/property.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define _LINUX_PROPERTY_H_
1212

1313
#include <linux/bits.h>
14+
#include <linux/cleanup.h>
1415
#include <linux/fwnode.h>
1516
#include <linux/types.h>
1617

@@ -148,6 +149,8 @@ struct fwnode_handle *device_get_named_child_node(const struct device *dev,
148149
struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode);
149150
void fwnode_handle_put(struct fwnode_handle *fwnode);
150151

152+
DEFINE_FREE(fwnode_handle, struct fwnode_handle *, fwnode_handle_put(_T))
153+
151154
int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index);
152155
int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name);
153156

0 commit comments

Comments
 (0)