Commit 3de22601 authored by Dan Carpenter's avatar Dan Carpenter Committed by James Bottomley

[SCSI] megaraid: missing bounds check in mimd_to_kioc()

pthru32->dataxferlen comes from the user so we need to check that it's
not too large so we don't overflow the buffer.
Reported-by: default avatarNico Golde <nico@ngolde.de>
Reported-by: default avatarFabian Yamaguchi <fabs@goesec.de>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarSumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent e5dbbe27
......@@ -486,6 +486,8 @@ mimd_to_kioc(mimd_t __user *umimd, mraid_mmadp_t *adp, uioc_t *kioc)
pthru32->dataxferaddr = kioc->buf_paddr;
if (kioc->data_dir & UIOC_WR) {
if (pthru32->dataxferlen > kioc->xferlen)
return -EINVAL;
if (copy_from_user(kioc->buf_vaddr, kioc->user_data,
pthru32->dataxferlen)) {
return (-EFAULT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment