public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: Qianqiang Liu <qianqiang.liu@163.com>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Steven Whitehouse <swhiteho@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-next@vger.kernel.org
Subject: [PATCH v2] KMSAN: uninit-value in inode_go_dump (5)
Date: Tue, 22 Oct 2024 20:00:38 +0800	[thread overview]
Message-ID: <ZxeT5ig2gOAUC7V4@fedora> (raw)
In-Reply-To: <CAHc6FU4DEhijmGR+Fc-RiOeg59sO1t=XnsqmeArQmssOXfDjgg@mail.gmail.com>

When mounting of a corrupted disk image fails, the error message printed
can reference uninitialized inode fields.  To prevent that from happening,
always initialize those fields.

Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
Reported-by: syzbot+aa0730b0a42646eb1359@syzkaller.appspotmail.com
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 Changes since v1:
 - Add Signed-off-by tag
---
 fs/gfs2/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 23e3a85ab7ef..aadb83e38c17 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1553,11 +1553,13 @@ static struct inode *gfs2_alloc_inode(struct super_block *sb)
 	if (!ip)
 		return NULL;
 	ip->i_no_addr = 0;
+	ip->i_no_formal_ino = 0;
 	ip->i_flags = 0;
 	ip->i_gl = NULL;
 	gfs2_holder_mark_uninitialized(&ip->i_iopen_gh);
 	memset(&ip->i_res, 0, sizeof(ip->i_res));
 	RB_CLEAR_NODE(&ip->i_res.rs_node);
+	ip->i_diskflags = 0;
 	ip->i_rahead = 0;
 	return &ip->i_inode;
 }
-- 
2.47.0


      reply	other threads:[~2024-10-22 12:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 20:50 linux-next: Signed-off-by missing for commit in the gfs2 tree Stephen Rothwell
2024-10-22 11:23 ` Qianqiang Liu
2024-10-22 11:34   ` Andreas Gruenbacher
2024-10-22 12:00     ` Qianqiang Liu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZxeT5ig2gOAUC7V4@fedora \
    --to=qianqiang.liu@163.com \
    --cc=agruenba@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox