diff options
author | Immad Mir <mirimmad17@gmail.com> | 2023-06-23 19:17:08 +0530 |
---|---|---|
committer | Dave Kleikamp <dave.kleikamp@oracle.com> | 2023-06-23 09:02:33 -0500 |
commit | 95e2b352c03b0a86c5717ba1d24ea20969abcacc (patch) | |
tree | 053e77eaf31df4d06678888bc066f7d0ae848748 /fs/jfs/jfs_txnmgr.c | |
parent | 47cfdc338d674d38f4b2f22b7612cc6a2763ba27 (diff) | |
download | linux-stable-95e2b352c03b0a86c5717ba1d24ea20969abcacc.tar.gz linux-stable-95e2b352c03b0a86c5717ba1d24ea20969abcacc.tar.bz2 linux-stable-95e2b352c03b0a86c5717ba1d24ea20969abcacc.zip |
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 <mirimmad17@gmail.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Diffstat (limited to 'fs/jfs/jfs_txnmgr.c')
-rw-r--r-- | fs/jfs/jfs_txnmgr.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index ffd4feece078..ce4b4760fcb1 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); |