From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755945AbcCBALK (ORCPT ); Tue, 1 Mar 2016 19:11:10 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:57058 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932538AbcCAX6X (ORCPT ); Tue, 1 Mar 2016 18:58:23 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=NO5FrMuQafeK++j1Lfl1d12qacBz5LweLRoXgCNiwwz9bHrawJn7q/HA/WHuX42Ti1mmHNLUA5un ZzfpJMWKIqkVEyzaWmrAHhNIxyqMNpUPmnfi395P5D9ce5Gtp5DC1POSzycoILcCDB5WeOALQcwK jZ1+1mRdXgUy+GFpHFk=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 313/342] xen/scsiback: correct frontend counting X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , Juergen Gross , Boris Ostrovsky , David Vrabel Message-Id: <20160301234537.989604358@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.9ed34c257a144f1ab8e3df086d1dbc43 X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:55:29 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Juergen Gross commit f285aa8db7cc4432c1a03f8b55ff34fe96317c11 upstream. When adding a new frontend to xen-scsiback don't decrement the number of active frontends in case of no error. Doing so results in a failure when trying to remove the xen-pvscsi nexus even if no domain is using it. Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky Signed-off-by: David Vrabel Signed-off-by: Greg Kroah-Hartman --- drivers/xen/xen-scsiback.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -939,12 +939,12 @@ out: spin_unlock_irqrestore(&info->v2p_lock, flags); out_free: - mutex_lock(&tpg->tv_tpg_mutex); - tpg->tv_tpg_fe_count--; - mutex_unlock(&tpg->tv_tpg_mutex); - - if (err) + if (err) { + mutex_lock(&tpg->tv_tpg_mutex); + tpg->tv_tpg_fe_count--; + mutex_unlock(&tpg->tv_tpg_mutex); kfree(new); + } return err; }