Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1926190pxb; Mon, 13 Sep 2021 08:18:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6bhj+vHdUIOLj6c6AXe0Zli/e7Ca7A2XVbeJH20+SfvUdZ1CWzJd5YyoaBd0veqCelp7H X-Received: by 2002:a6b:5a04:: with SMTP id o4mr9718145iob.44.1631546318864; Mon, 13 Sep 2021 08:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631546318; cv=none; d=google.com; s=arc-20160816; b=DZI3nATZi0RihFSiN/dcgNfhhaQGMxB35zxEnnD/ZyxDpjpcbFcUZtlbmq1ixrT5ve NWSU/WYTeFJ3rVlvqa5hUqhE5V3mh/AukC3qT8TE7yQ1G2JTu/91OO/zElzOuWvCVE6b i536WOQv8JVC2+35BQ91Q+y2p3pycZYeheh3JOTpWjtk21FGnWgWsX8GafSteLz1gCHw 4KvbvQteSdV9lBuDUO0jfNzLobh8byimoGf5Wx+D6FIhKgZ/BHdNbZiZ3Vh5hDqoweIb fBzIOuRQQpzJ8qgfcuktbPWhfmS6luPCjOBmTl+G4s/aafIMbOoaTeoNnbUtJVRClocI xzcg== 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=mo1NBPr+bQ9EazPo088sbrKUs/FIn3oYsLy4ISo+cOs=; b=A+oHRPpdggDq0kK86JLW5JQ9NlSCGPdEVwc2XA+dUD5wz1Co9Z8zaAxPSN62cIc1z9 QQGqnSHak3FUf2wFK06TmrWtJmBrs33cw+ZIhxr45nO2QyjurjXoKHT31VjZeUHyXWlt NNxhcEkdNL1J3B1BMS6v0NaMEhIR3OK61dChk8YHX8Q4opUNx6ZVhFIqyc4kPqibFv7W F1+5Dne4IkCAC8rcBiH8SVIzSgSGOSrGSEm5tZof2aIz0sqRrnF/ogYomIOs6WLD5Nyt uoyrJpYRCaLWYXF0s5Kw9ITGJibtP/k+SnujubT9G2kzE955Z9/MwPzNYFIFhUyFDV2C 6WlA== ARC-Authentication-Results: i=1; mx.google.com; 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si7640530jat.51.2021.09.13.08.18.23; Mon, 13 Sep 2021 08:18:38 -0700 (PDT) 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; 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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346016AbhIMPSq (ORCPT + 99 others); Mon, 13 Sep 2021 11:18:46 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3773 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345587AbhIMPSm (ORCPT ); Mon, 13 Sep 2021 11:18:42 -0400 Received: from fraeml744-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4H7VQt4QMqz683h2; Mon, 13 Sep 2021 23:15:18 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml744-chm.china.huawei.com (10.206.15.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Mon, 13 Sep 2021 17:17:24 +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.2308.8; Mon, 13 Sep 2021 16:17:22 +0100 From: John Garry To: CC: , , , , John Garry Subject: [PATCH RESEND v3 01/13] blk-mq: Change rqs check in blk_mq_free_rqs() Date: Mon, 13 Sep 2021 23:12:18 +0800 Message-ID: <1631545950-56586-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1631545950-56586-1-git-send-email-john.garry@huawei.com> References: <1631545950-56586-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Reviewed-by: Ming Lei --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 108a352051be..2316ff27c1f5 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2340,7 +2340,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++) { -- 2.26.2