From: "Darrick J. Wong" <djwong@kernel.org>
To: Andrey Albershteyn <aalbersh@redhat.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs_scrub: fix null pointer crash in scrub_render_ino_descr
Date: Fri, 21 Nov 2025 08:39:37 -0800 [thread overview]
Message-ID: <20251121163937.GN196370@frogsfrogsfrogs> (raw)
From: Darrick J. Wong <djwong@kernel.org>
Starting in Debian 13's libc6, passing a NULL format string to vsnprintf
causes the program to segfault. Prior to this, the null format string
would be ignored. Because @format is optional, let's explicitly steer
around the vsnprintf if there is no format string. Also tidy whitespace
in the comment.
Found by generic/45[34] on Debian 13.
Cc: <linux-xfs@vger.kernel.org> # v6.10.0
Fixes: 9a8b09762f9a52 ("xfs_scrub: use parent pointers when possible to report file operations")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
scrub/common.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/scrub/common.c b/scrub/common.c
index a50c810a7bd5a1..49f13466d389c1 100644
--- a/scrub/common.c
+++ b/scrub/common.c
@@ -404,7 +404,7 @@ within_range(
/*
* Render an inode number into a buffer in a format suitable for use in
* log messages. The buffer will be filled with:
- * "inode <inode number> (<ag number>/<ag inode number>)"
+ * "inode <inode number> (<ag number>/<ag inode number>)"
* If the @format argument is non-NULL, it will be rendered into the buffer
* after the inode representation and a single space.
*/
@@ -506,8 +506,11 @@ scrub_render_ino_descr(
pathlen = ret;
report_format:
- va_start(args, format);
- pathlen += vsnprintf(buf + pathlen, buflen - pathlen, format, args);
- va_end(args);
+ if (format) {
+ va_start(args, format);
+ pathlen += vsnprintf(buf + pathlen, buflen - pathlen, format,
+ args);
+ va_end(args);
+ }
return pathlen;
}
next reply other threads:[~2025-11-21 16:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 16:39 Darrick J. Wong [this message]
2025-11-24 9:28 ` [PATCH] xfs_scrub: fix null pointer crash in scrub_render_ino_descr Andrey Albershteyn
2025-11-24 9:35 ` Christoph Hellwig
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=20251121163937.GN196370@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=aalbersh@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/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