git: cd1180d273a8 - stable/15 - LinuxKPI: Clear the sbuf at the start of each call to seq_read
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Apr 2026 17:56:24 UTC
The branch stable/15 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=cd1180d273a88afb43dda9f27cca389e5d68d905
commit cd1180d273a88afb43dda9f27cca389e5d68d905
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-03-17 16:05:17 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-04-24 17:49:14 +0000
LinuxKPI: Clear the sbuf at the start of each call to seq_read
Each invocation of seq_read invokes the seq_file.show callback which
writes into the sbuf. Then it invokes sbuf_finish before copying the
data into the caller's buffer. Without this, a second call to
seq_read on the same file would try to append data to a finished sbuf.
Reviewed by: bz
Sponsored by: AFRL, DARPA
(cherry picked from commit c181c8f5ca707962359e636ca5aa536e60147eee)
---
sys/compat/linuxkpi/common/src/linux_seq_file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/compat/linuxkpi/common/src/linux_seq_file.c b/sys/compat/linuxkpi/common/src/linux_seq_file.c
index 9c06fe27bebe..6fe6ccd1e68e 100644
--- a/sys/compat/linuxkpi/common/src/linux_seq_file.c
+++ b/sys/compat/linuxkpi/common/src/linux_seq_file.c
@@ -49,6 +49,7 @@ seq_read(struct linux_file *f, char *ubuf, size_t size, off_t *ppos)
m = f->private_data;
sbuf = m->buf;
+ sbuf_clear(sbuf);
p = m->op->start(m, ppos);
rc = m->op->show(m, p);