Re: [PATCH] net: mctp: hold a reference to the route device in mctp_route_lookup()
From: Jeremy Kerr
Date: Thu Aug 13 2026 - 22:29:21 EST
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@xxxxxxxxx/
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