Messages in this thread | | | Subject | Re: [syzbot] [hfs?] WARNING in hfs_write_inode | From | Michael Schmitz <> | Date | Fri, 6 Jan 2023 20:09:11 +1300 |
| |
Hi Linus,
Am 06.01.2023 um 12:46 schrieb Michael Schmitz: > Hi Linus, > > Am 06.01.2023 um 10:53 schrieb Linus Torvalds: >> On Thu, Jan 5, 2023 at 1:35 PM Michael Schmitz <schmitzmic@gmail.com> >> wrote: >>> >>> Looking at Linus' patch, I wonder whether the missing fd.entrylength >>> size test in the HFS_IS_RSRC(inode) case was due to the fact that a >>> file's resource fork may be empty? >> >> But if that is the case, then the subsequent hfs_bnode_read would >> return garbage, no? And then writing it back after the update would be >> even worse. >> >> So adding that >> >> + if (fd.entrylength < sizeof(struct hfs_cat_file)) >> + goto out; >> >> would seem to be the right thing anyway. No? > > Yes, it would seem to be the right thing (in order to avoid further > corrupting HFS data structures). Returning -EIO might cause a regression > though.
A brief test on a HFS filesystem image (copy of my yaboot bootstrap partition) did not show any regression, so your patch appears to be just fine as-is.
Cheers,
Michael
| |