Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp771062pxp; Fri, 11 Mar 2022 14:41:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuDHp1Zf27D15STBdU8TJnGulk2GgjwNXzLN8h5z7uEjPfTaAIN+EHqd/ZrG2MLGA7nZKW X-Received: by 2002:a63:2055:0:b0:378:c5ee:888a with SMTP id r21-20020a632055000000b00378c5ee888amr10257450pgm.10.1647038504752; Fri, 11 Mar 2022 14:41:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647038504; cv=none; d=google.com; s=arc-20160816; b=jE7bdfSzmEAVb8wE6gTAWXQ2ePsmyaRP4m0bIrqYmRKAOp/kQlOCW9/uAK4IkZT1UZ 5U9tGZA/qMfLwzl/bhhmierKjG6X03AQ0F8xMjifRNqvgcLC+SiwOLw+MbquUwdz/KW1 wvG3o/pEx3V7v8agl94tSsduL4ZjjiqYwO7hGPXvckvHzYj1zS/wFNBuziwTpQNErGRh z/eK4sKl2HSD/oF2evXc5u/1C2Iwi5YmfaR0VVSUccKXkyKycBSMc82QuYB48QqB+1Kt sna16O94VVHp7TVzzfIjfKQD3jzfXmJ7zDA2oe5HRedpsghh8vXNH1HZdAU2WkmjNQIC Abhw== 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; bh=vz69dKaRaMMam3XBeSu9AYmIvBy8xCxXbYdHbLopsrE=; b=Y7fw/ynYpOCRIn4Szlrp9qcrONsF3CmyFPE1NfIYfRBWF77lYlIXEg14ejOxso9GFJ 8+5CzSCbXG33aEZwL/uVHf+SbTeEDtJ8kJR4MkQXslqsR0OR7fn9IlDbi/St/4/A5Gt7 w9KObw/363zhr+YndvL21Bk580kW/I+bsVJGq1eRsXUcs9mcM79SZyn/oioLDuPR6dv2 M3nzpmoUMx9hgpvMlBccnpHvkz/k6fbtGo4IwkxbcJntRJZw0Um0bI8ni7C/A9ugtjC7 eQ7ERD2maN4C/mID0fjPF28pdtBBhLgkWI40ZQYUN2925tB8FKZQGVk/a4vzRmtQ+ECI N56w== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 128-20020a630086000000b0037c714b60b2si8848568pga.465.2022.03.11.14.41.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:41:44 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 513B8254ABD; Fri, 11 Mar 2022 13:48:54 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233180AbiCKIhb (ORCPT + 99 others); Fri, 11 Mar 2022 03:37:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231364AbiCKIha (ORCPT ); Fri, 11 Mar 2022 03:37:30 -0500 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4CB2E1BA14D for ; Fri, 11 Mar 2022 00:36:26 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-03 (Coremail) with SMTP id rQCowACnx5gBCitimT5sAg--.54677S2; Fri, 11 Mar 2022 16:36:18 +0800 (CST) From: Jiasheng Jiang To: rpeterso@redhat.com, agruenba@redhat.com Cc: cluster-devel@redhat.com, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] gfs2: Add check for mempool_alloc Date: Fri, 11 Mar 2022 16:36:16 +0800 Message-Id: <20220311083616.2213689-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowACnx5gBCitimT5sAg--.54677S2 X-Coremail-Antispam: 1UD129KBjvdXoWrur4rZr4fJF13Ar4fGF1kAFb_yoWxKwc_Ca n7ZFsxCw45JF9YkF18A3yIyrnYk3y5uF1fWFs3K3sxGas5ta47J34jkw15Ar4DGFZ0grnx G34qya9xZ3WxWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbzxFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_Cr1j6rxdM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxG rwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4 vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IY x2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26c xKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x02 67AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUbrMaUUUUUU== X-Originating-IP: [124.16.138.126] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 As the potential failure of mempool_alloc(), it could return NULL pointer. Therefore, it should be better to check it in order to avoid the dereference of the NULL pointer. Fixes: e8c92ed76900 ("GFS2: Clean up log write code path") Signed-off-by: Jiasheng Jiang --- fs/gfs2/log.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index f0ee3ff6f9a8..10dd09e9b0e4 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -837,6 +837,9 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, return; page = mempool_alloc(gfs2_page_pool, GFP_NOIO); + if (!page) + return; + lh = page_address(page); clear_page(lh); -- 2.25.1