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

Jeremy Kerr <[email protected]>
Newsgroups gmane.linux.network,gmane.linux.kernel
Message-ID <55cd94e61d68d95e9db16f21980a532f4edf70e1.camel@codeconstruct.com.au>
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/[email protected]/

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.