Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756819Ab3CSAC5 (ORCPT ); Mon, 18 Mar 2013 20:02:57 -0400 Received: from mail-pb0-f48.google.com ([209.85.160.48]:62056 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756796Ab3CSACz (ORCPT ); Mon, 18 Mar 2013 20:02:55 -0400 Date: Mon, 18 Mar 2013 17:04:11 -0700 From: Greg Kroah-Hartman To: =?iso-8859-1?Q?J=F6rn?= Engel Cc: "Nicholas A. Bellinger" , linux-kernel@vger.kernel.org, target-devel Subject: Re: [PATCH] target: close target_put_sess_cmd() vs. core_tmr_abort_task() race Message-ID: <20130319000411.GA6406@kroah.com> References: <20130318222853.GA9358@logfs.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20130318222853.GA9358@logfs.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 766 Lines: 20 On Mon, Mar 18, 2013 at 06:28:53PM -0400, J?rn Engel wrote: > It is possible for one thread to to take se_sess->sess_cmd_lock in > core_tmr_abort_task() before taking a reference count on > se_cmd->cmd_kref, while another thread in target_put_sess_cmd() drops > se_cmd->cmd_kref before taking se_sess->sess_cmd_lock. > > This introduces kref_put_and_lock() and uses it in > target_put_sess_cmd() to close the race window. We already have kref_put_mutex(), why not just call this kref_put_spinlock()? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/