Commit ea1c928b authored by Sumit Saxena's avatar Sumit Saxena Committed by Martin K. Petersen

megaraid_sas: Fix SMAP issue

Inside compat IOCTL hook of driver, driver was using wrong address of
ioc->frame.raw which leads sense_ioc_ptr to be calculated wrongly and
failing IOCTL.
Signed-off-by: default avatarSumit Saxena <sumit.saxena@avagotech.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8f67c8c5
...@@ -6843,9 +6843,9 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) ...@@ -6843,9 +6843,9 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)
int i; int i;
int error = 0; int error = 0;
compat_uptr_t ptr; compat_uptr_t ptr;
unsigned long local_raw_ptr;
u32 local_sense_off; u32 local_sense_off;
u32 local_sense_len; u32 local_sense_len;
u32 user_sense_off;
if (clear_user(ioc, sizeof(*ioc))) if (clear_user(ioc, sizeof(*ioc)))
return -EFAULT; return -EFAULT;
...@@ -6863,17 +6863,16 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) ...@@ -6863,17 +6863,16 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg)
* sense_len is not null, so prepare the 64bit value under * sense_len is not null, so prepare the 64bit value under
* the same condition. * the same condition.
*/ */
if (get_user(local_raw_ptr, ioc->frame.raw) || if (get_user(local_sense_off, &ioc->sense_off) ||
get_user(local_sense_off, &ioc->sense_off) || get_user(local_sense_len, &ioc->sense_len) ||
get_user(local_sense_len, &ioc->sense_len)) get_user(user_sense_off, &cioc->sense_off))
return -EFAULT; return -EFAULT;
if (local_sense_len) { if (local_sense_len) {
void __user **sense_ioc_ptr = void __user **sense_ioc_ptr =
(void __user **)((u8*)local_raw_ptr + local_sense_off); (void __user **)((u8 *)((unsigned long)&ioc->frame.raw) + local_sense_off);
compat_uptr_t *sense_cioc_ptr = compat_uptr_t *sense_cioc_ptr =
(compat_uptr_t *)(cioc->frame.raw + cioc->sense_off); (compat_uptr_t *)(((unsigned long)&cioc->frame.raw) + user_sense_off);
if (get_user(ptr, sense_cioc_ptr) || if (get_user(ptr, sense_cioc_ptr) ||
put_user(compat_ptr(ptr), sense_ioc_ptr)) put_user(compat_ptr(ptr), sense_ioc_ptr))
return -EFAULT; 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