In the Linux kernel, the following vulnerability has been resolved:
nilfs2: do not write dirty data after degenerating to read-only
According to syzbot's report, markbufferdirty() called from nilfssegctordo_construct() outputs a warning with some patterns after nilfs2 detects metadata corruption and degrades to read-only mode.
After such read-only degeneration, page cache data may be cleared through nilfscleardirtypage() which may also clear the uptodate flag for their buffer heads. However, even after the degeneration, log writes are still performed by unmount processing etc., which causes markbuffer_dirty() to be called for buffer heads without the "uptodate" flag and causes the warning.
Since any writes should not be done to a read-only file system in the first place, this fixes the warning in markbufferdirty() by letting nilfssegctordo_construct() abort early if in read-only mode.
This also changes the retry check of nilfssegctorwriteout() to avoid unnecessary log write retries if it detects -EROFS that nilfssegctordoconstruct() returned.