Re: [PATCH net] net: mctp: i3c: serialize probe with bus removal
From: Matt Johnston
Date: Thu Sep 03 2026 - 06:00:03 EST
On Wed, 2026-09-02 at 15:01 +0900, XingWang Xiang wrote:
> mctp_i3c_probe() drops busdevs_lock after finding the matching bus. A
> concurrent I3C_NOTIFY_BUS_REMOVE can then unregister and free the bus
> netdev before probe passes its private data to mctp_i3c_add_device().
> The latter consequently adds a list node through a freed mbus pointer.
>
> Keep busdevs_lock held until the device has been added. This also
> satisfies the __must_hold annotation on mctp_i3c_add_device().
Thanks, this looks right. Building with CONTEXT_ANALYSIS caught this as well
as some other problems,
I'll send patches separately.
For this patch Sashiko reports some other existing problems in mctp-i3c, I'll
check those.
Acked-by: Matt Johnston <matt@xxxxxxxxxxxxxxxxxxxx>
Cheers,
Matt