Skip to content

Commit

Permalink
FS: JFS: Check for read-only mounted filesystem in txBegin
Browse files Browse the repository at this point in the history
 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>
  • Loading branch information
mirimmad authored and kleikamp committed Jun 23, 2023
1 parent 47cfdc3 commit 95e2b35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/jfs/jfs_txnmgr.c
Expand Up @@ -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);
Expand Down

0 comments on commit 95e2b35

Please sign in to comment.