linux/drivers/of
Douglas Anderson f72e77c33e device property: Make modifications of fwnode "flags" thread safe
In various places in the kernel, we modify the fwnode "flags" member
by doing either:
  fwnode->flags |= SOME_FLAG;
  fwnode->flags &= ~SOME_FLAG;

This type of modification is not thread-safe. If two threads are both
mucking with the flags at the same time then one can clobber the
other.

While flags are often modified while under the "fwnode_link_lock",
this is not universally true.

Create some accessor functions for setting, clearing, and testing the
FWNODE flags and move all users to these accessor functions. New
accessor functions use set_bit() and clear_bit(), which are
thread-safe.

Cc: stable@vger.kernel.org
Fixes: c2c724c868 ("driver core: Add fw_devlink_parse_fwtree()")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Reviewed-by: Saravana Kannan <saravanak@kernel.org>
Link: https://patch.msgid.link/20260317090112.v2.1.I0a4d03104ecd5103df3d76f66c8d21b1d15a2e38@changeid
[ Fix fwnode_clear_flag() argument alignment, restore dropped blank
  line in fwnode_dev_initialized(), and remove unnecessary parentheses
  around fwnode_test_flag() calls. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-03-26 22:00:59 +01:00
..
unittest-data of: unittest: Add a test case for for_each_of_imap_item iterator 2026-01-15 12:03:27 +01:00
.kunitconfig
Kconfig
Makefile
address.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
base.c device property: Make modifications of fwnode "flags" thread safe 2026-03-26 22:00:59 +01:00
cpu.c
device.c
dynamic.c device property: Make modifications of fwnode "flags" thread safe 2026-03-26 22:00:59 +01:00
empty_root.dts
fdt.c arm64: kdump: Fix elfcorehdr overlap caused by reserved memory processing reorder 2025-12-16 07:59:30 -06:00
fdt_address.c
irq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
kexec.c of/kexec: refactor ima_get_kexec_buffer() to use ima_validate_range() 2026-01-26 19:07:11 -08:00
kobj.c
kunit_overlay_test.dtso
module.c
of_kunit_helpers.c of: Skip devicetree kunit tests when RISCV+ACPI doesn't populate root node 2025-11-26 19:46:23 -06:00
of_numa.c
of_private.h
of_reserved_mem.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
of_test.c
overlay.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
overlay_test.c
pdt.c
platform.c device property: Make modifications of fwnode "flags" thread safe 2026-03-26 22:00:59 +01:00
property.c of: property: fw_devlink: Add support for "mmc-pwrseq" 2026-02-03 20:58:11 -06:00
resolver.c
unittest.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00