1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-21 07:15:49 +00:00

geom: Report copyout() errors in g_ctl_ioctl_ctl()

Despite the name, req->serror is used in some cases to copy non-error
messages to userspace.  So, report errors when copying out so long as
they don't clobber an earlier error.

Reviewed by:	mav, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43146
This commit is contained in:
Mark Johnston 2023-12-25 20:43:06 -05:00
parent 6cdff09c0d
commit bbf221e3e8

View File

@ -616,8 +616,10 @@ g_ctl_ioctl_ctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct th
}
}
if (sbuf_done(req->serror)) {
copyout(sbuf_data(req->serror), req->error,
nerror = copyout(sbuf_data(req->serror), req->error,
imin(req->lerror, sbuf_len(req->serror) + 1));
if (nerror != 0 && req->nerror == 0)
req->nerror = nerror;
}
nerror = req->nerror;