[PATCH] fs: Fix uninitialized value issue in from_kuid
From: Alessandro Zanni
Date: Wed Oct 16 2024 - 08:38:43 EST
Fix uninitialized value issue in from_kuid by initializing the newattrs
structure in do_truncate() method.
Fixes: uninit-value in from_kuid reported here
https://syzkaller.appspot.com/bug?extid=6c55f725d1bdc8c52058
Reported-by: syzbot+6c55f725d1bdc8c52058@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=6c55f725d1bdc8c52058
Signed-off-by: Alessandro Zanni <alessandro.zanni87@xxxxxxxxx>
---
fs/open.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/open.c b/fs/open.c
index acaeb3e25c88..57c298b1db2c 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -40,7 +40,7 @@ int do_truncate(struct mnt_idmap *idmap, struct dentry *dentry,
loff_t length, unsigned int time_attrs, struct file *filp)
{
int ret;
- struct iattr newattrs;
+ struct iattr newattrs = {0};
/* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
if (length < 0)
--
2.43.0