Re: [PATCH 15/24] thunderbolt: Rework control channel to be more reliable
From: Mika Westerberg
Date: Thu May 25 2017 - 10:35:59 EST
On Thu, May 25, 2017 at 03:25:46PM +0200, Greg Kroah-Hartman wrote:
> > +/**
> > + * tb_cfg_request_put() - Decrease refcount and possibly release the request
> > + * @req: Request whose refcount is decreased
> > + *
> > + * Call this function when you are done with the request. When refcount
> > + * goes to %0 the object is released.
> > + */
> > +void tb_cfg_request_put(struct tb_cfg_request *req)
> > +{
> > + kref_put(&req->kref, tb_cfg_request_destroy);
> > +}
>
> What prevents this call from being called twice on the same object from
> different threads at the same time? You still need a lock somewhere to
> protect yourself from that, am I just missing where that lock is?
No, you are right - it is missing a lock. I will add it there in the
next version.
Thanks.