Skip to content

Commit 95e2b35

Browse files
mirimmadkleikamp
authored andcommitted
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>
1 parent 47cfdc3 commit 95e2b35

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fs/jfs/jfs_txnmgr.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,11 @@ tid_t txBegin(struct super_block *sb, int flag)
354354
jfs_info("txBegin: flag = 0x%x", flag);
355355
log = JFS_SBI(sb)->log;
356356

357+
if (!log) {
358+
jfs_error(sb, "read-only filesystem\n");
359+
return 0;
360+
}
361+
357362
TXN_LOCK();
358363

359364
INCREMENT(TxStat.txBegin);

0 commit comments

Comments
 (0)