mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Fix uioskip crash when skip to end
When doing uioskip to skip an iovec to the very end, the current loop condition will falsely check pass the end of iovec. We fix this checking uio_iovcnt first. Signed-off-by: Chunwei Chen <tuxoko@gmail.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3806 Closes #3850
This commit is contained in:
parent
b815ec32b3
commit
45838e3a41
@ -236,13 +236,15 @@ uioskip(uio_t *uiop, size_t n)
|
||||
|
||||
uiop->uio_skip += n;
|
||||
if (uiop->uio_segflg != UIO_BVEC) {
|
||||
while (uiop->uio_skip >= uiop->uio_iov->iov_len) {
|
||||
while (uiop->uio_iovcnt &&
|
||||
uiop->uio_skip >= uiop->uio_iov->iov_len) {
|
||||
uiop->uio_skip -= uiop->uio_iov->iov_len;
|
||||
uiop->uio_iov++;
|
||||
uiop->uio_iovcnt--;
|
||||
}
|
||||
} else {
|
||||
while (uiop->uio_skip >= uiop->uio_bvec->bv_len) {
|
||||
while (uiop->uio_iovcnt &&
|
||||
uiop->uio_skip >= uiop->uio_bvec->bv_len) {
|
||||
uiop->uio_skip -= uiop->uio_bvec->bv_len;
|
||||
uiop->uio_bvec++;
|
||||
uiop->uio_iovcnt--;
|
||||
|
Loading…
Reference in New Issue
Block a user