Re: [PATCH v3] hfs: remove BUG() from hfs_release_folio()/hfs_test_inode()/hfs_write_inode()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2025/07/22 2:04, Viacheslav Dubeyko wrote:
> On Fri, 2025-07-18 at 07:08 +0900, Tetsuo Handa wrote:
>> On 2025/07/18 4:49, Viacheslav Dubeyko wrote:
>>> I assume if we created the inode as normal with i_ino == 0, then we can make it
>>> as a dirty. Because, inode will be made as bad inode here [2] only if rec->type
>>> is invalid. But if it is valid, then we can create the normal inode even with
>>> i_ino == 0.
>>
>> You are right. The crafted filesystem image in the reproducer is hitting HFS_CDR_DIR with
>> inode->i_ino = 0 ( https://elixir.bootlin.com/linux/v6.16-rc6/source/fs/hfs/inode.c#L363   ).
> 
> So, any plans to rework the patch?
> 

What do you mean by "rework"?

I can update patch description if you have one, but I don't plan to try something like below.

@@ -393,20 +393,30 @@ struct inode *hfs_iget(struct super_block *sb, struct hfs_cat_key *key, hfs_cat_
        switch (rec->type) {
        case HFS_CDR_DIR:
                cnid = be32_to_cpu(rec->dir.DirID);
                break;
        case HFS_CDR_FIL:
                cnid = be32_to_cpu(rec->file.FlNum);
                break;
        default:
                return NULL;
        }
+       if (cnid < HFS_FIRSTUSER_CNID) {
+               switch (cnid) {
+               case HFS_ROOT_CNID:
+               case HFS_EXT_CNID:
+               case HFS_CAT_CNID:
+                       break;
+               default:
+                       return NULL;
+               }
+       }
        inode = iget5_locked(sb, cnid, hfs_test_inode, hfs_read_inode, &data);
        if (inode && (inode->i_state & I_NEW))
                unlock_new_inode(inode);
        return inode;
 }





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux