From: Immad Mir Date: Fri, 23 Jun 2023 13:47:08 +0000 (+0530) Subject: FS: JFS: Check for read-only mounted filesystem in txBegin X-Git-Tag: v6.5-rc1~150^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95e2b352c03b0a86c5717ba1d24ea20969abcacc;p=thirdparty%2Flinux.git FS: JFS: Check for read-only mounted filesystem in txBegin 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 --- diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index ffd4feece0785..ce4b4760fcb1d 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);