Re: Re: [PATCH] net: mctp: hold a reference to the route device in mctp_route_lookup()

From: Yiqi Sun

Date: Mon Aug 17 2026 - 08:15:15 EST


Hi Jeremy,

> Hi Aldo,
>
> > mctp_route_lookup() uses rt->dev without holding a reference on it.
>
> [...]
>
> > Take a reference with refcount_inc_not_zero() before touching rt->dev,
> > skip a device that is already dead, and drop the reference once the
> > destination has taken its own.
>
> This looks the same as Yiqi Sun's analysis:
>
> https://lore.kernel.org/netdev/20260731022926.913865-1-sunyiqixm@xxxxxxxx=
> m/
>
> I had requested some simplifications for the proposed fix, which would
> likely result in something very close to your contribution here.
>
> Yiqi had not followed up from that review as yet, though; so if we don't
> see any updated patch shortly, then your implementation looks reasonable.
>
> Regards,
>
>
> Jeremy

Sorry for the delay. I haven't had a chance to send v2 yet.

I've reviewed Aldo's patch, and the approach looks good to me. It addresses
the same issue I was trying to fix, so I'm happy for Aldo's patch to
supersede mine.

Thanks for picking this up, Aldo, and thanks for the review, Jeremy.

Regards,
Yiqi