git: c181c8f5ca70 - main - LinuxKPI: Clear the sbuf at the start of each call to seq_read
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 17 Mar 2026 16:10:14 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=c181c8f5ca707962359e636ca5aa536e60147eee
commit c181c8f5ca707962359e636ca5aa536e60147eee
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-03-17 16:05:17 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-03-17 16:05:17 +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
---
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);