Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2186319imw; Sun, 17 Jul 2022 03:26:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1umu82MRh4Q5m4Tr+5S+9u6kWGaV579CyBLvuYh1B/VaEfRdqMs0ce8RaEB2TZoz2EkWqiQ X-Received: by 2002:a05:6402:201:b0:431:665f:11f1 with SMTP id t1-20020a056402020100b00431665f11f1mr30654162edv.378.1658053597390; Sun, 17 Jul 2022 03:26:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658053597; cv=none; d=google.com; s=arc-20160816; b=lUamGWb3ZmUi6k+Qp7/zYWhY8ZH0gUkRRY/UhhIx4ljFhj2YnHnawipX+ax+OZj8xV NYL3IVQRts7IVfuC+1Ybpd4qrT0Hdu4dLB4xO18T1Q4tjbCva6KFgs9MkqVCk8vTT6Yk qH38xRJxcjzirisvQmzPbWyhO/Izehw1AcphFWKXWBVeULoR+xU+1ZIsJeMJ219t79UW BdHrmI6diZYdIXdGhi1uXdKcBQ5kIvO7759VOzdp8gggkHSAB48KMxxkXB4Jx7UxJbAn HN4ZEj6cPfgoGXmExHqwk+l+N5j5NiQmJ7ojfcUM+yrcOYmWDu3iaHGnO3OdbJFpwup5 LOVw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=N8jLDe75DF7X7EgllRZVFN7v6x4x8NvijaCiwku09NM=; b=NrGKongc1vGmezIB85/7wujdp2dz3ANBXEs5c3bsSwneViZ/dTa2eYCocGq/MxgOzL rCGChwp46t395MpfGemZuXegj+eMD99ADzjZ3Q3c1OM0ieW5LWHYjE/5JUvpAmMqmmNp Fr7HOLdiEnstlmJ/J+GoFYYYhVv1aIWQm4f7158BE3TA0R1PMB3ZYyyxwEdflOdzoCcb uGYCi41ZnltIYiyY7/NvpQbZ2D0ELun5XuMHVKLTNMK4eFbGDvI3KJ1CCYLd8ADvWOIg 8zXax+OwIwxYr/sjdqX26tQY/aLI0QFhGXeDsu21v5CXnlilM25wADeRrSphCtYRTS58 dqAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lQRJ54gU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020aa7cd47000000b0043ac75e8f64si10899199edw.387.2022.07.17.03.26.12; Sun, 17 Jul 2022 03:26:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=lQRJ54gU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232300AbiGQKXD (ORCPT + 99 others); Sun, 17 Jul 2022 06:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbiGQKW4 (ORCPT ); Sun, 17 Jul 2022 06:22:56 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10F1214018; Sun, 17 Jul 2022 03:22:56 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id cp18-20020a17090afb9200b001ef79e8484aso10732792pjb.1; Sun, 17 Jul 2022 03:22:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N8jLDe75DF7X7EgllRZVFN7v6x4x8NvijaCiwku09NM=; b=lQRJ54gUPs9huk/nj/SXTN6PbuPH6CofkN1QOBX+gWiVMP1SdMvN+IikLIaBZTYhCc N3wxXgz8h4ZY/Mv4VZLsXQUiLagiif0v+MVowe2ge7tvRdWhbLykwWUgzV+cs4+AVp6w p1Y+cjhjn+kPazbKCRle91Tw6I4zLUf8LWsfzrKFNuBAu2ZUSsEB4/MxH2TGl3xCgNqM qWOf05+pFVYBOj3uAALLxXT+ZIkstVfpD17ox2xe8JRCBeUuk+2D4QNqh9YwFlQsOqOl VFJXpUQYJWJnVXGBe3/aLRjQ2WdnpFzYz/JN7W6q8BEWkDoa0fWhtRCpktPRVrahSJEp RrEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=N8jLDe75DF7X7EgllRZVFN7v6x4x8NvijaCiwku09NM=; b=HguM7gJ0EVZceIuFDzK1mOHUwTNyjV0wMSeUt7msS4MwFCA+GMGTkgoXjiM/qhJ5/t DLwAe169o1UxPUEu5dMZq7Owqw0/KBZvSQcz51ZXVhxryxbQhDKCXyG0l4AYFIVEf135 oKyyUx1Mxx+NcjYed6qRHKMPosGonOtQLum/t8uHZ/ynm5bh/5PRkhiBpUv9vpL6IPCx YS06o4qK97P2d12gPwZj2vIgRUnrb0GsGBRzwDUK8d/rhF94zTiV6+zlMzGr5uqcIw43 f2017OhH8hrE7MJ6piEuDT/K+0uxnI0pwYvvrlaBM8pl4fedy6TK9F/Mn3pgSp3XgSg7 7y5A== X-Gm-Message-State: AJIora+TOW903eltXIrYYJNBTsa0gpCy9pFdnr63gPKePLSCy1VuwVAM gQmz0/oBN/yGTlBQN2GjdSI= X-Received: by 2002:a17:902:ec8b:b0:16c:1cc2:6794 with SMTP id x11-20020a170902ec8b00b0016c1cc26794mr22122293plg.17.1658053375335; Sun, 17 Jul 2022 03:22:55 -0700 (PDT) Received: from biggie.. ([103.230.148.189]) by smtp.gmail.com with ESMTPSA id pf12-20020a17090b1d8c00b001ef8ab65052sm6945516pjb.11.2022.07.17.03.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jul 2022 03:22:54 -0700 (PDT) From: Gautam Menghani To: axboe@kernel.dk Cc: Gautam Menghani , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org Subject: [RFC] block: Add a NULL check in blk_mq_free_rqs() Date: Sun, 17 Jul 2022 15:52:42 +0530 Message-Id: <20220717102242.219424-1-gautammenghani201@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Syzbot reported a general protection fault in the function blk_mq_clear_rq_mapping() in the file block/blk-mq.c. The issue is that the variable drv_tags is NULL, and this originates from the struct blk_mq_tag_set. The dashboard link for this issue is : syzkaller.appspot.com/bug?id=c3ce4caa4fc58c156d4903984131cdfa38eee354 This patch fixes the above bug, but there is another syzbot bug which is related to this and getting triggered after the call to blk_mq_clear_rq_mapping(). As a result, I cannot determine if the issue is really solved. The link to other issue: syzkaller.appspot.com/bug?id=7643cea70f1d0ce15f5f4bc39488918837ad4233 Please provide feedback/suggestions on the same. Signed-off-by: Gautam Menghani --- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 93d9d60980fb..c1dd1b78b95c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -3092,7 +3092,8 @@ void blk_mq_free_rqs(struct blk_mq_tag_set *set, struct blk_mq_tags *tags, } } - blk_mq_clear_rq_mapping(drv_tags, tags); + if (drv_tags) + blk_mq_clear_rq_mapping(drv_tags, tags); while (!list_empty(&tags->page_list)) { page = list_first_entry(&tags->page_list, struct page, lru); -- 2.34.1