aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2026-03-17 16:05:17 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2026-03-17 16:05:17 +0000
commitc181c8f5ca707962359e636ca5aa536e60147eee (patch)
tree9f8c6275b522a0d939b769cb845abe4f05a6f809
parent1d13d938fe6c7639d2bb4cb5248a1f81275b6891 (diff)
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
-rw-r--r--sys/compat/linuxkpi/common/src/linux_seq_file.c1
1 files changed, 1 insertions, 0 deletions
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);