Thread (8 messages) 8 messages, 4 authors, 2026-03-26

Re: [PATCH v2] device property: Make modifications of fwnode "flags" thread safe

From: "Rafael J. Wysocki" <rafael@kernel.org>
Date: 2026-03-17 16:23:04
Also in: driver-core, imx, linux-acpi, linux-arm-kernel, linux-devicetree, linux-i2c, linux-spi, lkml, stable

On Tue, Mar 17, 2026 at 5:20 PM Danilo Krummrich [off-list ref] wrote:
On 3/17/2026 5:11 PM, Rafael J. Wysocki wrote:
quoted
On Tue, Mar 17, 2026 at 5:04 PM Douglas Anderson [off-list ref] wrote:
quoted
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: c2c724c868c4 ("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>
Rafael J. Wysocki (Intel) [off-list ref]
ACK or RB?
RB, sorry.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help