From patchwork Wed Jul 14 15:06:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 476764 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp659485jao; Wed, 14 Jul 2021 08:11:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmk/nK3lRZU/FNG90ZUDqdZlHIys+CqM8wTkKrw2mdrdegw7PltGHfh4tjOcjbuTARkdkt X-Received: by 2002:a17:906:7302:: with SMTP id di2mr12612476ejc.409.1626275483632; Wed, 14 Jul 2021 08:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626275483; cv=none; d=google.com; s=arc-20160816; b=Zb9EVip9ldm1++KPD8tJ8F0814altF7DdgLsVVZBRYlO0/tEo6opKCqoqpcq36v+WZ idC41qu3a+beOqHK3Oy1Ckd0xc1bJwRPjGDZ6DyxPl8fO6zXbv/pQ2tQjE2wTswuORaO FzqAwgO+XrmSxfheQ4gnPN1XwxwRzMEinFP2s37KGjzVqafbK29bQdrvTpcWy73pic/F kzuEzVH1n3sK2Mgy5xWAtdRcuSHnk1G/IG8Ryfjd0vFrCVqBDQVyzIurr3lINUAEzQO6 WCeEuwj7Vmw2CLSlBpI3lUFp1cA9gnOujulhVwzZUbOu9tS4L6lZE6Edbx+85Y4ustrf o9wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=cRi0M/9m6SyqNDMzCnVYgjGiG+PncB97EOStCY9e1zo=; b=xRYpgnjyeLOaS6cpqWjOXrW7jbYA/+IsW7gYU5WbPxotdmeTZCz64c5PyZVenR7jFT PB2RnPqvx1noaE7fBvNV+2Mq6Nwj0XxAOY09Wp7j8j3jX7jrEnbxz3hn6+bOdkWrLa5Z cZTd8Ut/hq7M/PXy6j9WBLgUftyY/S9regGdP11qsid1YsUvvk9OPOwwYUVmFWlBNEZo /LMYg9EKla0FRWgcxsQQ9jtqm17K6FCBNqgqaO7Vm0Alxq2qxcTnBUBAsFtcleUrAIYe wZ3sevT/Ex0bHh+ewyVQ/kjkiZdhBM1l9DqKjmikfdsCjOu4uDpHGO/KyL1aw5pBy6O/ FGlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z20si2999812edc.592.2021.07.14.08.11.23 for ; Wed, 14 Jul 2021 08:11:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239580AbhGNPOJ (ORCPT ); Wed, 14 Jul 2021 11:14:09 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3404 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239576AbhGNPOJ (ORCPT ); Wed, 14 Jul 2021 11:14:09 -0400 Received: from fraeml703-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GQ12Y4Q6hz6K64C; Wed, 14 Jul 2021 23:02:45 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml703-chm.china.huawei.com (10.206.15.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 14 Jul 2021 17:11:15 +0200 Received: from localhost.localdomain (10.69.192.58) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 14 Jul 2021 16:11:13 +0100 From: John Garry To: CC: , , , , , , John Garry Subject: [PATCH 1/9] blk-mq: Change rqs check in blk_mq_free_rqs() Date: Wed, 14 Jul 2021 23:06:27 +0800 Message-ID: <1626275195-215652-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1626275195-215652-1-git-send-email-john.garry@huawei.com> References: <1626275195-215652-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The original code in commit 24d2f90309b23 ("blk-mq: split out tag initialization, support shared tags") would check tags->rqs is non-NULL and then dereference tags->rqs[]. Then in commit 2af8cbe30531 ("blk-mq: split tag ->rqs[] into two"), we started to dereference tags->static_rqs[], but continued to check non-NULL tags->rqs. Check tags->static_rqs as non-NULL instead, which is more logical. Signed-off-by: John Garry --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.26.2 Reviewed-by: Ming Lei diff --git a/block/blk-mq.c b/block/blk-mq.c index 2c4ac51e54eb..ae28f470893c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2348,7 +2348,7 @@ void blk_mq_free_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags, { struct page *page; - if (tags->rqs && set->ops->exit_request) { + if (tags->static_rqs && set->ops->exit_request) { int i; for (i = 0; i < tags->nr_tags; i++) {