From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6592C83F21 for ; Mon, 28 Aug 2023 10:24:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231218AbjH1KYb (ORCPT ); Mon, 28 Aug 2023 06:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231158AbjH1KXy (ORCPT ); Mon, 28 Aug 2023 06:23:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FF8E127 for ; Mon, 28 Aug 2023 03:23:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E3607639C3 for ; Mon, 28 Aug 2023 10:23:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F30C5C433C8; Mon, 28 Aug 2023 10:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1693218228; bh=kAhfCinygzZgVA6jaY7D/42VEHrCcpY77KRcBELRbCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNjicAe7AVwbWgqoTDpkHvJ1hSK/1F97+OgWUceL/fK6XrdOjASUsXo6I4Gm8CrKl Xd4+h4oYyRnuFXbaFsLME+Wi0uXxLMeVMa2UDoPdbnc46r33fF113bGIdr6UwJ+21w N61yWCTlI+Pdu+yi716dQ3Pfq+j3FZKBobU+mdaM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Immad Mir , Dave Kleikamp , Sasha Levin Subject: [PATCH 4.19 012/129] FS: JFS: Check for read-only mounted filesystem in txBegin Date: Mon, 28 Aug 2023 12:11:46 +0200 Message-ID: <20230828101153.498769232@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230828101153.030066927@linuxfoundation.org> References: <20230828101153.030066927@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Immad Mir [ Upstream commit 95e2b352c03b0a86c5717ba1d24ea20969abcacc ] This patch adds a check for read-only mounted filesystem in txBegin before starting a transaction potentially saving from NULL pointer deref. Signed-off-by: Immad Mir Signed-off-by: Dave Kleikamp Signed-off-by: Sasha Levin --- fs/jfs/jfs_txnmgr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index 78789c5ed36b0..e10db01f253b8 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c @@ -367,6 +367,11 @@ tid_t txBegin(struct super_block *sb, int flag) jfs_info("txBegin: flag = 0x%x", flag); log = JFS_SBI(sb)->log; + if (!log) { + jfs_error(sb, "read-only filesystem\n"); + return 0; + } + TXN_LOCK(); INCREMENT(TxStat.txBegin); -- 2.40.1