Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Mar 2022 11:34:14 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5145a7927845 - stable/13 - lindebugfs: Fix write
Message-ID:  <202203051134.225BYEJN046466@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=5145a7927845688e34d597b4312a13ac66817b26

commit 5145a7927845688e34d597b4312a13ac66817b26
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-01-31 13:46:16 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-03-05 11:12:43 +0000

    lindebugfs: Fix write
    
    For write operation pseudofs creates an sbuf with the data.
    Use this data instead of the uio as it's not usable anymore after
    uiomove.
    
    Reviewed by:    hselasky
    MFC after:      1 week
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D34114
    
    (cherry picked from commit 867b4decb4d50579152e52c594632cdc0f6266ff)
---
 sys/compat/lindebugfs/lindebugfs.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/compat/lindebugfs/lindebugfs.c b/sys/compat/lindebugfs/lindebugfs.c
index 63161eedf14f..8eaa41412fd2 100644
--- a/sys/compat/lindebugfs/lindebugfs.c
+++ b/sys/compat/lindebugfs/lindebugfs.c
@@ -130,8 +130,14 @@ debugfs_fill(PFS_FILL_ARGS)
 	if ((rc = linux_set_current_flags(curthread, M_NOWAIT)))
 		return (rc);
 	vn.v_data = d->dm_data;
-	buf = uio->uio_iov[0].iov_base;
-	len = min(uio->uio_iov[0].iov_len, uio->uio_resid);
+	if (uio->uio_rw == UIO_READ) {
+		buf = uio->uio_iov[0].iov_base;
+		len = min(uio->uio_iov[0].iov_len, uio->uio_resid);
+	} else {
+		sbuf_finish(sb);
+		buf = sbuf_data(sb);
+		len = sbuf_len(sb);
+	}
 	off = 0;
 	lf.private_data = NULL;
 	rc = d->dm_fops->open(&vn, &lf);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203051134.225BYEJN046466>