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
(cherry picked from commit bbf221e3e8)
This commit is contained in:
parent
494fe2e050
commit
bd287fa8bc
1 changed files with 3 additions and 1 deletions
|
|
@ -617,8 +617,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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue