From patchwork Thu Jun 25 14:01:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 213699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCCD2C433E0 for ; Thu, 25 Jun 2020 14:01:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF91F20707 for ; Thu, 25 Jun 2020 14:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405287AbgFYOBr (ORCPT ); Thu, 25 Jun 2020 10:01:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:41110 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405285AbgFYOBr (ORCPT ); Thu, 25 Jun 2020 10:01:47 -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 C30F0AD2C; Thu, 25 Jun 2020 14:01:45 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , John Garry , Don Brace , Bart van Assche , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 06/22] fnic: check for started requests in fnic_wq_copy_cleanup_handler() Date: Thu, 25 Jun 2020 16:01:08 +0200 Message-Id: <20200625140124.17201-7-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200625140124.17201-1-hare@suse.de> References: <20200625140124.17201-1-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org fnic_wq_copy_cleanup_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/fnic/fnic_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 04879ced2835..13db2181d3fd 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c @@ -1464,7 +1464,7 @@ void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq, return; sc = scsi_host_find_tag(fnic->lport->host, id); - if (!sc) + if (!sc || !blk_mq_request_started(sc->request)) return; io_lock = fnic_io_lock_hash(fnic, sc);