summaryrefslogtreecommitdiff
path: root/fs/jfs
diff options
context:
space:
mode:
authorImmad Mir <mirimmad17@gmail.com>2023-06-23 16:47:08 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-26 16:26:44 +0300
commit5c094ca994824e038b6a97835ded4e5d1d808504 (patch)
tree5c02910a70f68588fe22846ce977ea6538d8c330 /fs/jfs
parent2a3f20efe6c901d4c0871cfd1d8c65e2ade71fc1 (diff)
downloadlinux-5c094ca994824e038b6a97835ded4e5d1d808504.tar.xz
FS: JFS: Check for read-only mounted filesystem in txBegin
[ 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 <mirimmad17@gmail.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/jfs_txnmgr.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index c8ce7f1bc594..6f6a5b9203d3 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);