* hfsplus: Initialize directory subfolders in hfsplus_mknod
@ 2024-07-27 4:51 Siddharth Menon
2024-07-27 4:54 ` Al Viro
2024-07-27 5:13 ` Greg KH
0 siblings, 2 replies; 6+ messages in thread
From: Siddharth Menon @ 2024-07-27 4:51 UTC (permalink / raw)
To: linux-fsdevel; +Cc: linux-kernel-mentees, Siddharth Menon
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/btree.c | 1 +
fs/hfsplus/dir.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c
index 9e1732a2b92a..13d2e90cb9b1 100644
--- a/fs/hfsplus/btree.c
+++ b/fs/hfsplus/btree.c
@@ -363,6 +363,7 @@ int hfs_bmap_reserve(struct hfs_btree *tree, int rsvd_nodes)
HFSPLUS_SB(tree->sb)->alloc_blksz_shift;
hip->fs_blocks =
hip->alloc_blocks << HFSPLUS_SB(tree->sb)->fs_shift;
+ hip->subfolders = 0;
inode_set_bytes(inode, inode->i_size);
count = inode->i_size >> tree->node_size_shift;
tree->free_nodes += count - tree->node_count;
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index f5c4b3e31a1c..a4eb287e3d4b 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -485,11 +485,14 @@ 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;
- if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode))
- init_special_inode(inode, mode, rdev);
+ if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)){
+ init_special_inode(inode, mode, rdev);}
res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
if (res)
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: hfsplus: Initialize directory subfolders in hfsplus_mknod
2024-07-27 4:51 hfsplus: Initialize directory subfolders in hfsplus_mknod Siddharth Menon
@ 2024-07-27 4:54 ` Al Viro
2024-07-27 5:13 ` Greg KH
1 sibling, 0 replies; 6+ messages in thread
From: Al Viro @ 2024-07-27 4:54 UTC (permalink / raw)
To: Siddharth Menon; +Cc: linux-fsdevel, linux-kernel-mentees
On Sat, Jul 27, 2024 at 10:21:29AM +0530, Siddharth Menon wrote:
> - if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode))
> - init_special_inode(inode, mode, rdev);
> + if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)){
> + init_special_inode(inode, mode, rdev);}
Huh? What's that chunk about?
^ permalink raw reply [flat|nested] 6+ messages in thread
* hfsplus: Initialize directory subfolders in hfsplus_mknod
@ 2024-07-27 5:05 Siddharth Menon
0 siblings, 0 replies; 6+ messages in thread
From: Siddharth Menon @ 2024-07-27 5:05 UTC (permalink / raw)
To: linux-fsdevel; +Cc: linux-kernel-mentees, Siddharth Menon
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(+)
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: hfsplus: Initialize directory subfolders in hfsplus_mknod
2024-07-27 4:51 hfsplus: Initialize directory subfolders in hfsplus_mknod Siddharth Menon
2024-07-27 4:54 ` Al Viro
@ 2024-07-27 5:13 ` Greg KH
1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2024-07-27 5:13 UTC (permalink / raw)
To: Siddharth Menon; +Cc: linux-fsdevel, linux-kernel-mentees
On Sat, Jul 27, 2024 at 10:21:29AM +0530, Siddharth Menon wrote:
> 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
>
Odd indentation :(
Also, why the extra blank line before:
> Signed-off-by: Siddharth Menon <simeddon@gmail.com>
This one?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* hfsplus: Initialize directory subfolders in hfsplus_mknod
@ 2024-07-27 5:23 Siddharth Menon
2024-07-27 5:47 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Siddharth Menon @ 2024-07-27 5:23 UTC (permalink / raw)
To: linux-fsdevel
Cc: linux-kernel-mentees, syzbot+fdedff847a0e5e84c39f,
Siddharth Menon
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(+)
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;
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: hfsplus: Initialize directory subfolders in hfsplus_mknod
2024-07-27 5:23 Siddharth Menon
@ 2024-07-27 5:47 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2024-07-27 5:47 UTC (permalink / raw)
To: Siddharth Menon
Cc: linux-fsdevel, linux-kernel-mentees, syzbot+fdedff847a0e5e84c39f
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-07-27 5:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-27 4:51 hfsplus: Initialize directory subfolders in hfsplus_mknod Siddharth Menon
2024-07-27 4:54 ` Al Viro
2024-07-27 5:13 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2024-07-27 5:05 Siddharth Menon
2024-07-27 5:23 Siddharth Menon
2024-07-27 5:47 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).