From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B61411C83 for ; Mon, 28 Aug 2023 10:35:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BF96C433C7; Mon, 28 Aug 2023 10:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1693218939; bh=eM7DXoDCqiNkdbgcAZcx28RaS2ps1qQKbBjUhB9tvKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMdC0OLgJvl5d3RKb6GZ1ICtVGcVguT8F4BO1HtGkcfKmTFgvCfg9HQJ2stKePzqB wCPLSaVbpPUdwXMQ3PXaFV8Ek0Xb+vsh2qF25gOg7T09kA7ujJWAlEMqTb3pBVoXFs WiV3kOINbTRBtQYUFA+SOafayKKCu03y6aSf1tZI= 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 5.4 016/158] FS: JFS: Check for read-only mounted filesystem in txBegin Date: Mon, 28 Aug 2023 12:11:53 +0200 Message-ID: <20230828101157.888700554@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230828101157.322319621@linuxfoundation.org> References: <20230828101157.322319621@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-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 c8ce7f1bc5942..6f6a5b9203d3f 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c @@ -354,6 +354,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