From patchwork Fri Jul 3 13:01:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 11641881 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCDC4912 for ; Fri, 3 Jul 2020 13:01:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC20E2070A for ; Fri, 3 Jul 2020 13:01:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726726AbgGCNBr (ORCPT ); Fri, 3 Jul 2020 09:01:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:53350 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbgGCNBb (ORCPT ); Fri, 3 Jul 2020 09:01:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AB384AF44; Fri, 3 Jul 2020 13:01:27 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , Bart van Assche , John Garry , Don Brace , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 12/21] snic: check for started requests in snic_hba_reset_cmpl_handler() Date: Fri, 3 Jul 2020 15:01:13 +0200 Message-Id: <20200703130122.111448-13-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200703130122.111448-1-hare@suse.de> References: <20200703130122.111448-1-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org snic_hba_reset_cmpl_handler() is using scsi_host_find_tag() to map id to a scsi command. However, as per discussion on the mailinglist scsi_host_find_tag() might return a non-started request, so we need to check the returned command with blk_mq_request_started() to avoid the function tripping over a non-initialized command. Signed-off-by: Hannes Reinecke --- drivers/scsi/snic/snic_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c index 9f9a497beb5c..b000a926e194 100644 --- a/drivers/scsi/snic/snic_scsi.c +++ b/drivers/scsi/snic/snic_scsi.c @@ -1020,7 +1020,7 @@ snic_hba_reset_cmpl_handler(struct snic *snic, struct snic_fw_req *fwreq) } sc = scsi_host_find_tag(snic->shost, cmnd_id); - if (!sc) { + if (!sc || !blk_mq_request_started(sc->request)) { atomic64_inc(&snic->s_stats.io.sc_null); SNIC_HOST_ERR(snic->shost, "reset_cmpl: sc is NULL - Hdr Stat %s Tag 0x%x\n",