jfs: add check read-only before truncation in jfs_truncate_nolock()
In the Linux kernel, the following vulnerability has been resolved:
jfs: add check read-only before truncation in jfs_truncate_nolock()
Added a check for "read-only" mode in the jfs_truncate_nolock
function to avoid errors related to writing to a read-only
filesystem.
Call stack:
block_write_begin() { jfs_write_failed() { jfs_truncate() { jfs_truncate_nolock() { txEnd() { ... log = JFS_SBI(tblk->sb)->log; // (log == NULL)
If the isReadOnly(ip) condition is triggered in
jfs_truncate_nolock, the function execution will stop, and no
further data modification will occur. Instead, the xtTruncate
function will be called with the "COMMIT_WMAP" flag, preventing
modifications in "read-only" mode.