Skip to contentSkip to conversation

hfsplus: Initialize directory subfolders in hfsplus_mknod

PATCH In review Siddharth Menon 2 participants 2 messages Jul 27, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hfsplus: Initialize directory subfolders in hfsplus_mknod

Addresses uninitialized subfolders attribute being used in hfsplus_subfolders_inc and hfsplus_subfolders_dec.

---
Removed changes that was accidentally added while debugging and reformatted the message.

 fs/hfsplus/dir.c | 3 +++
 1 file changed, 3 insertions(+)

644

fs/hfsplus/dir.c +3 -0
@@ -485,6 +485,9 @@ static int hfsplus_mknod(struct mnt_idmap *idmap, struct inode *dir,
 
 	mutex_lock(&sbi->vh_mutex);
 	inode = hfsplus_new_inode(dir->i_sb, dir, mode);
+	if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags))
+		HFSPLUS_I(dir)->subfolders = 0;
+
 	if (!inode)
 		goto out;
 
Signature · 1 line
2.39.2
#1 lore raw
Quoted 2 lines · Siddharth Menon

Addresses uninitialized subfolders attribute being used in hfsplus_subfolders_inc and hfsplus_subfolders_dec.

This is a really poor commit message. It needs to be more descriptive. How can this happen? Is it just a fuzzing thing?

Quoted 27 lines

---
Removed changes that was accidentally added while debugging and reformatted the message.

 fs/hfsplus/dir.c | 3 +++
 1 file changed, 3 insertions(+)

644

fs/hfsplus/dir.c +3 -0
@@ -485,6 +485,9 @@ static int hfsplus_mknod(struct mnt_idmap *idmap, struct inode *dir,
 
 	mutex_lock(&sbi->vh_mutex);
 	inode = hfsplus_new_inode(dir->i_sb, dir, mode);
+	if (test_bit(HFSPLUS_SB_HFSX, &sbi->flags))
+		HFSPLUS_I(dir)->subfolders = 0;
+
 	if (!inode)
 		goto out;
 
Signature · 1 line
2.39.2