Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17930879ybl; Thu, 2 Jan 2020 15:03:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwL0N4obbeqCiePSScPybN6q9trBUN9woipV75K6fOlPNrzOh5KSQU3rKNaZ+KSljnFiryS X-Received: by 2002:a9d:1e4:: with SMTP id e91mr91043201ote.324.1578006185998; Thu, 02 Jan 2020 15:03:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578006185; cv=none; d=google.com; s=arc-20160816; b=qqMeR/n7zTJ7dHvJs4sk5vMDud257sWx8GdQP+DeVegA6SihOK/u0kufyoWi1ROuw2 tju4wopx3h0LZg/U57vzdr/bZtYsKwxsHeexk67NqtPGtSvwlN3L2N+2/ZSVVz51IzfU v86yWmPww7sP0aoBLzJEc+DDhaIXEzGc26IZj8ziZznbiU5tFKfEHpIaXN3VUVemrSt6 af9cklKpr1dFQhWsM5ywyKkVZr125fHkHjJ0fvvbx23t1ttJr0d0loDr0tQsHy1tuF7P 3qP9HS01+C6hVTGb72ipvBnBYc1NcUQbfNDMmBtDCokq2cMrixgpvtWXo+eZjaPxY/U2 cRUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f0emVn33IvH8dhle7BsexVRhhZlUYc5srRbWvyzelLw=; b=xB1XlP7p3bB8Gh70NxiCNQYDup3nMMDxtwZBNJkY+hI75K7KIPdOQhh2mR0unkSELi jpTg2dzlgkCFVYjTYNSjAah6wwwJYG6J+aO0FJEku87vQxghzV9Dr//8R0Dzokz51/8w et9BwQpo6N3EjKs2bNSDXUc2zakxgJ6jUF1WtcQJ3B9ggdOZeSak8kpTwHG4Trl2c0ZR O1umlnCnQU3YabqZrasWYSfsiz5ipYWlWVz/I8WkLJU0rpZV4pNojI4YLN5ZGjgGBz/m 92L746cK+5gKc65GV3+C6UPWSwvLCvvEFtsdTIbA50eskTLUt1pA6QEXX0zrQizVyx7h uysg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cEkb+DV+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p21si20400835otk.162.2020.01.02.15.02.54; Thu, 02 Jan 2020 15:03:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cEkb+DV+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727232AbgABWLo (ORCPT + 99 others); Thu, 2 Jan 2020 17:11:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:50012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727189AbgABWLi (ORCPT ); Thu, 2 Jan 2020 17:11:38 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57875222C3; Thu, 2 Jan 2020 22:11:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003097; bh=fTwjluxhBBmv3GW4XjlrlfB97qurdemDcrxQbQXNCUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cEkb+DV+XfksJIZ0wZD8Lc5923gw62S+uHd4A+HiNpZhzp04x7RFAQ6e3QUi4+Gbf TnTtoh8ps4/VEem7UjurtJbco6O2dkxT9EzX7sqc8UaS+nB1Htd3+LwLHCiaZXAgzm 3mSlxLVbcSpm5V+xee12mKbWlJxoWWrPn9o45gVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhangguanghui , Dick Kennedy , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 019/191] scsi: lpfc: Fix hardlockup in lpfc_abort_handler Date: Thu, 2 Jan 2020 23:05:01 +0100 Message-Id: <20200102215831.933817549@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Smart [ Upstream commit 91a52b617cdb8bf6d298892101c061d438b84a19 ] In lpfc_abort_handler, the lock acquire order is hbalock (irqsave), buf_lock (irq) and ring_lock (irq). The issue is that in two places the locks are released out of order - the buf_lock and the hbalock - resulting in the cpu preemption/lock flags getting restored out of order and deadlocking the cpu. Fix the unlock order by fully releasing the hbalocks as well. CC: Zhangguanghui Link: https://lore.kernel.org/r/20191018211832.7917-7-jsmart2021@gmail.com Signed-off-by: Dick Kennedy Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_scsi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index ad8ef67a1db3..aa82d538a18a 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -4846,20 +4846,21 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) ret_val = __lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, abtsiocb, 0); } - /* no longer need the lock after this point */ - spin_unlock_irqrestore(&phba->hbalock, flags); if (ret_val == IOCB_ERROR) { /* Indicate the IO is not being aborted by the driver. */ iocb->iocb_flag &= ~LPFC_DRIVER_ABORTED; lpfc_cmd->waitq = NULL; spin_unlock(&lpfc_cmd->buf_lock); + spin_unlock_irqrestore(&phba->hbalock, flags); lpfc_sli_release_iocbq(phba, abtsiocb); ret = FAILED; goto out; } + /* no longer need the lock after this point */ spin_unlock(&lpfc_cmd->buf_lock); + spin_unlock_irqrestore(&phba->hbalock, flags); if (phba->cfg_poll & DISABLE_FCP_RING_INT) lpfc_sli_handle_fast_ring_event(phba, -- 2.20.1