diff options
| author | Sean Bruno <sbruno@FreeBSD.org> | 2016-04-18 23:26:11 +0000 |
|---|---|---|
| committer | Sean Bruno <sbruno@FreeBSD.org> | 2016-04-18 23:26:11 +0000 |
| commit | a0adbb3df15f083bb5435aa579d574e1cb82e7ce (patch) | |
| tree | e2b08022c32e7dbfb268f0e9573a8c714bd7d931 /sys/dev/hptmv | |
| parent | 87ed2b7f5a213578bd523c9f2ec217934167319a (diff) | |
Notes
Diffstat (limited to 'sys/dev/hptmv')
| -rw-r--r-- | sys/dev/hptmv/hptproc.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/hptmv/hptproc.c b/sys/dev/hptmv/hptproc.c index 3981b71eb2a5..9e897567e079 100644 --- a/sys/dev/hptmv/hptproc.c +++ b/sys/dev/hptmv/hptproc.c @@ -308,7 +308,9 @@ hpt_set_info(int length) /* * map buffer to kernel. */ - if (piop->nInBufferSize+piop->nOutBufferSize > PAGE_SIZE) { + if (piop->nInBufferSize > PAGE_SIZE || + piop->nOutBufferSize > PAGE_SIZE || + piop->nInBufferSize+piop->nOutBufferSize > PAGE_SIZE) { KdPrintE(("User buffer too large\n")); return -EINVAL; } @@ -319,8 +321,13 @@ hpt_set_info(int length) return -EINVAL; } - if (piop->nInBufferSize) - copyin((void*)(ULONG_PTR)piop->lpInBuffer, ke_area, piop->nInBufferSize); + if (piop->nInBufferSize) { + if (copyin((void*)(ULONG_PTR)piop->lpInBuffer, ke_area, piop->nInBufferSize) != 0) { + KdPrintE(("Failed to copyin from lpInBuffer\n")); + free(ke_area, M_DEVBUF); + return -EFAULT; + } + } /* * call kernel handler. @@ -342,7 +349,7 @@ hpt_set_info(int length) else KdPrintW(("Kernel_ioctl(): return %d\n", err)); free(ke_area, M_DEVBUF); - return -EINVAL; + return -EINVAL; } else { KdPrintW(("Wrong signature: %x\n", piop->Magic)); return -EINVAL; |
