Properly free the temporary sf_buf in uiomove_fromphys() if a copyin or

copyout fails.

Obtained from: DragonFlyBSD
This commit is contained in:
Alan Cox 2004-08-21 18:50:34 +00:00
parent 85bafe5ec3
commit 0b6a0b955a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=134127
2 changed files with 7 additions and 2 deletions

View file

@ -94,8 +94,10 @@ uiomove_fromphys(vm_page_t ma[], vm_offset_t offset, int n, struct uio *uio)
error = copyout(cp, iov->iov_base, cnt);
else
error = copyin(iov->iov_base, cp, cnt);
if (error)
if (error) {
sf_buf_free(sf);
goto out;
}
break;
case UIO_SYSSPACE:
if (uio->uio_rw == UIO_READ)

View file

@ -107,8 +107,11 @@ uiomove_fromphys(vm_page_t ma[], vm_offset_t offset, int n, struct uio *uio)
error = copyout(cp, iov->iov_base, cnt);
else
error = copyin(iov->iov_base, cp, cnt);
if (error)
if (error) {
if (sf != NULL)
sf_buf_free(sf);
goto out;
}
break;
case UIO_SYSSPACE:
if (uio->uio_rw == UIO_READ)