summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>2026-11-02 16:25:16 +0100
committerJohan Hovold <johan@kernel.org>2026-11-09 16:42:51 +0100
commitf8623ce596492d2e96ca57eeec992938d3d79f00 (patch)
tree32146b9edd06a641f6c2ead6177bb0f34b03f92e /rust/kernel/alloc
parent7475ea8b58616b33c04afb976cf0fbaad9dd63fb (diff)
software node: only let the owner release a managed node
device_create_managed_software_node() creates a node whose lifetime is tied to the device it was created for. software_node_notify_remove() is called for every device that has the node as its fwnode (primary OR secondary) and, if the node is managed, unconditionally detaches it from that device and drops the creation reference. This breaks when the node is shared with another device. Example: the i2c-designware copies the parent's fwnode to the adapter's struct device. When the adapter is deleted, it releases the reference that belongs to the owner and the latter ends up with a dangling pointer. Record the device's "manager" and only perform the actual release when notify is called for that "owner" device. Note that it was never the intention that managed software nodes would be shared, but descendants reusing ancestor firmware nodes is not uncommon and such use is hard to predict when allocating software nodes. Reported-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com> Closes: https://lore.kernel.org/all/20261009164241.923756-2-balasubramani.vivekanandan@intel.com/ Fixes: 151f6ff78cdf ("software node: Provide replacement for device_add_properties()") Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Fixes: 0f485f88656a ("drm/xe/i2c: use device_create_managed_software_node()") Reviewed-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com> Tested-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20261102-swnode-only-owner-release-v1-1-ee4c9022a629@oss.qualcomm.com [ johan: drop temporary variable; skip clearing owner field; mention reuse not intended in commit message ] Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'rust/kernel/alloc')
0 files changed, 0 insertions, 0 deletions