]> git.ipfire.org Git - thirdparty/linux.git/commit
i3c: master: Prevent reuse of dynamic address on device add failure
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 12 Jun 2026 08:01:03 +0000 (11:01 +0300)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 14 Jun 2026 19:49:11 +0000 (21:49 +0200)
commitb3ba8383da4d0cff15810e32ea785eceb0a80813
tree08d1718a5b2c323c1ed81c8c3c7a90919192e610
parentad7fba5cbd6d7ff139a08e7c83edec4536314430
i3c: master: Prevent reuse of dynamic address on device add failure

i3c_master_add_i3c_dev_locked() is called after a device has already
been assigned a dynamic address.  If the function fails, the address
remains marked as free and may be reallocated to another device,
leading to address conflicts on the bus.

Ensure the address is not marked as free on failure, by updating the
address slot state to prevent the address from being re-used.

Emit an error message to inform of the failure.

Opportunistically remove the !master check because it is impossible.

Note, directly resetting the device's dynamic address is no longer
an option, since Direct RSTDAA was deprecated from I3C starting from
version 1.1 and v1.1 (or later) target devices are meant to NACK it.

Fixes: 3a379bbcea0af ("i3c: Add core I3C infrastructure")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260612080107.11606-4-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master.c