Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp803712pxb; Tue, 3 Nov 2020 13:00:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9DqNJbREmqrQYl0h0tKolXMEKY55jimBP+Qi6rChnzMRTV/sRHJQWER6mnQsifW3AV6SI X-Received: by 2002:a17:906:1643:: with SMTP id n3mr21581663ejd.459.1604437234628; Tue, 03 Nov 2020 13:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437234; cv=none; d=google.com; s=arc-20160816; b=lh7vVC6PI+/L6xEgYSBUTH0daMYEDe3Zv4cnrZIkOJn5r+Ttc5z2oFdreemk0TRcHg YKLRdsFDbGHt4a3zwZzqRCiEWo+QBU2Y2Vi+P9jV+Up+51nklVAG6xlVOJ3/59o8I6pZ s+2jQOlU6x+xr+CkJAsYB8P1Wrk4Wm+nWPhKcAnEUveWr//JaTY5k8g+JeYTSS+ZgUD3 hYrk7VF2nDpAZJ3csZVLG8DVuFmaDL0emgAktoEr+fgvAJXpjGVpKI8C52x2leuCrSaE aCLxG+b/cyi5mzNo2SdHvOxWdxjiDmkIETVt2G8BzNpcS4HVQaV+P6nA7j1Z3yFQxQJT W41A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yoqlkpzlk8YwxZqXoWowIL9GEdqPIovTvlJVoNHMY6c=; b=d7ecxqv9fmQ7NhaziCNBWWpsUTm6SCQuff7M0vUXzW3WHRfW/dl/CBmlxc7Hd9U2uE WUHqCAHBWw6hpbieEUTNZii64MPJvUKTeUZkKmamCCFelWi9K5AeEIp77bb2tUgnZcjW ICHWwWwz8IQhj7iIfMUjhvfvNwyueyB8GmgUcqA+Ge14dAV3KrVVOR7eyLMq/mCNW0w6 son7HK4EZBS2UMXbpCHhOzrSNqOjsoKpERk5j7z//ZCFRZUdhK7B6en4tiondO/LFGNt /nXXvlfE6X+1Pw9AwqwlA1EVTzldXtF2T8zD25V+4JyTaZQTrAea8b6+9KleaihV4DTP fsog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MdBVxclr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt25si2240093edb.572.2020.11.03.13.00.11; Tue, 03 Nov 2020 13:00:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MdBVxclr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733038AbgKCU6z (ORCPT + 99 others); Tue, 3 Nov 2020 15:58:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:33508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733026AbgKCU6w (ORCPT ); Tue, 3 Nov 2020 15:58:52 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 11BA32053B; Tue, 3 Nov 2020 20:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437130; bh=lTsYLD4/3AZ0wNQQTQ9iTZNTU29uhtenMZP9Qvc8jRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MdBVxclrNxg/5aHYlHtwz8J16lQCeOvKBqCT2RAn7U6B9syNvjKDYMEn5H3CtVh/j 6HqmdUOlmpl2FOOzfpwcEnpAVfNYTN80NOaD6rOlgQMFOeXSApQzAVbmfSFsbAKyw0 zVEyebx8r+alxFfTucDSIMuHOLSv6fgJR1x1ZXRo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.4 120/214] scsi: qla2xxx: Fix crash on session cleanup with unload Date: Tue, 3 Nov 2020 21:36:08 +0100 Message-Id: <20201103203302.131319515@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quinn Tran commit 50457dab670f396557e60c07f086358460876353 upstream. On unload, session cleanup prematurely gave the signal for driver unload path to advance. Link: https://lore.kernel.org/r/20200929102152.32278-6-njavali@marvell.com Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery") Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_target.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1230,14 +1230,15 @@ void qlt_schedule_sess_for_deletion(stru case DSC_DELETE_PEND: return; case DSC_DELETED: - if (tgt && tgt->tgt_stop && (tgt->sess_count == 0)) - wake_up_all(&tgt->waitQ); - if (sess->vha->fcport_count == 0) - wake_up_all(&sess->vha->fcport_waitQ); - if (!sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN] && - !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT]) + !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT]) { + if (tgt && tgt->tgt_stop && tgt->sess_count == 0) + wake_up_all(&tgt->waitQ); + + if (sess->vha->fcport_count == 0) + wake_up_all(&sess->vha->fcport_waitQ); return; + } break; case DSC_UPD_FCPORT: /*