git: 867b4decb4d5 - main - lindebugfs: Fix write
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 04 Feb 2022 13:31:18 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=867b4decb4d50579152e52c594632cdc0f6266ff
commit 867b4decb4d50579152e52c594632cdc0f6266ff
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-01-31 13:46:16 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-02-04 13:31:08 +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
---
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);