From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938404AbdEYOfo (ORCPT ); Thu, 25 May 2017 10:35:44 -0400 Received: from mga03.intel.com ([134.134.136.65]:63213 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933935AbdEYOfn (ORCPT ); Thu, 25 May 2017 10:35:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,391,1491289200"; d="scan'208";a="91711168" Date: Thu, 25 May 2017 17:35:36 +0300 From: Mika Westerberg To: Greg Kroah-Hartman Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , Lukas Wunner , Amir Levy , Andy Lutomirski , Mario.Limonciello@dell.com, Jared.Dominguez@dell.com, Andy Shevchenko , linux-kernel@vger.kernel.org Subject: Re: [PATCH 15/24] thunderbolt: Rework control channel to be more reliable Message-ID: <20170525143536.GT8541@lahna.fi.intel.com> References: <20170518143914.60902-1-mika.westerberg@linux.intel.com> <20170518143914.60902-16-mika.westerberg@linux.intel.com> <20170525132546.GI16244@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170525132546.GI16244@kroah.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.