diff mbox series

hfsplus: Initialize directory subfolders in hfsplus_mknod

Message ID 20240727052349.74139-1-simeddon@gmail.com (mailing list archive)
State New
Headers show
Series hfsplus: Initialize directory subfolders in hfsplus_mknod | expand

Commit Message

Siddharth Menon July 27, 2024, 5:23 a.m. UTC
hfsplus: Initialize directory subfolders in hfsplus_mknod

Addresses uninitialized subfolders attribute being used in `hfsplus_subfolders_inc` and `hfsplus_subfolders_dec`.

Fixes: https://syzkaller.appspot.com/bug?extid=fdedff847a0e5e84c39f
Reported-by: syzbot+fdedff847a0e5e84c39f@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/x/report.txt?x=16efda06680000
Signed-off-by: Siddharth Menon <simeddon@gmail.com>
---
 fs/hfsplus/dir.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Greg KH July 27, 2024, 5:47 a.m. UTC | #1
On Sat, Jul 27, 2024 at 10:53:50AM +0530, Siddharth Menon wrote:
> hfsplus: Initialize directory subfolders in hfsplus_mknod

Shouldn't this be in the subject line only?

And no [PATCH]?

> Addresses uninitialized subfolders attribute being used in `hfsplus_subfolders_inc` and `hfsplus_subfolders_dec`.

Linewrap please.

> 
> Fixes: https://syzkaller.appspot.com/bug?extid=fdedff847a0e5e84c39f
> Reported-by: syzbot+fdedff847a0e5e84c39f@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/x/report.txt?x=16efda06680000
> Signed-off-by: Siddharth Menon <simeddon@gmail.com>
> ---
>  fs/hfsplus/dir.c | 3 +++
>  1 file changed, 3 insertions(+)

As this is a v2 patch, you must describe below the --- line what changed
from the first one.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index f5c4b3e31a1c..331c4118bc8e 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -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;