Re: [PATCH] i2c: amd-mp2: Unregister callback on adapter add failure
Andi Shyti <[email protected]> Sat, 25 Jul 2026 01:03:25 +0200
| Newsgroups | org.kernel.vger.linux-i2c,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
Hi Myeonghun,
On Tue, Jul 21, 2026 at 11:41:47PM +0900, Myeonghun Pak wrote:
> amd_mp2_register_cb() stores the platform I2C context in the MP2 PCI
> driver's callback table before the adapter is registered. If
> i2c_add_adapter() fails, probe returns and devres frees the context,
> but the PCI driver can still dereference the stale pointer from its IRQ
> and system-sleep callbacks.
>
> Unregister the callback before returning the adapter registration error.
>
> Fixes: 529766e0a011 ("i2c: Add drivers for the AMD PCIe MP2 I2C controller")
> Cc: [email protected]
> Co-developed-by: Ijae Kim <[email protected]>
> Signed-off-by: Ijae Kim <[email protected]>
> Signed-off-by: Myeonghun Pak <[email protected]>
merged to i2c/i2c-fixes.
Thanks,
Andi