diff options
author | sumit.saxena@avagotech.com <sumit.saxena@avagotech.com> | 2015-10-15 13:40:54 +0530 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2015-11-02 22:56:13 -0500 |
commit | 323c4a02c631d00851d8edc4213c4d184ef83647 (patch) | |
tree | 3535d1c715787f6254c632a0da1c60132fd2c67b /drivers/scsi/megaraid | |
parent | 0b48d12d0365a628d2257a4560b3b06c825fe1cd (diff) | |
download | linux-stable-323c4a02c631d00851d8edc4213c4d184ef83647.tar.gz linux-stable-323c4a02c631d00851d8edc4213c4d184ef83647.tar.bz2 linux-stable-323c4a02c631d00851d8edc4213c4d184ef83647.zip |
megaraid_sas : SMAP restriction--do not access user memory from IOCTL code
This is an issue on SMAP enabled CPUs and 32 bit apps running on 64 bit
OS. Do not access user memory from kernel code. The SMAP bit restricts
accessing user memory from kernel code.
Cc: <stable@vger.kernel.org>
Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com>
Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas_base.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 071ea1cad41c..cc953725d9be 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -6470,6 +6470,9 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) int i; int error = 0; compat_uptr_t ptr; + unsigned long local_raw_ptr; + u32 local_sense_off; + u32 local_sense_len; if (clear_user(ioc, sizeof(*ioc))) return -EFAULT; @@ -6487,9 +6490,15 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) * sense_len is not null, so prepare the 64bit value under * the same condition. */ - if (ioc->sense_len) { + if (get_user(local_raw_ptr, ioc->frame.raw) || + get_user(local_sense_off, &ioc->sense_off) || + get_user(local_sense_len, &ioc->sense_len)) + return -EFAULT; + + + if (local_sense_len) { void __user **sense_ioc_ptr = - (void __user **)(ioc->frame.raw + ioc->sense_off); + (void __user **)((u8*)local_raw_ptr + local_sense_off); compat_uptr_t *sense_cioc_ptr = (compat_uptr_t *)(cioc->frame.raw + cioc->sense_off); if (get_user(ptr, sense_cioc_ptr) || |