Commit 22c88425 authored by Kashyap, Desai's avatar Kashyap, Desai Committed by James Bottomley

[SCSI] mpt2sas: Use compat_ptr to setup the pointer compatibility.

On ppc64, an 32bit application was failing due to data buffers not being
copied properly from user to kernel memory.  The problem due to improper
conversion of 32 to 64 bit pointers.  The fix is to use compat_ptr to
setup the pointer compatibility in the routine _ctl_compat_mpt_command.
Signed-off-by: default avatarKashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: default avatarEric Moore <eric.moore@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent e75b9b6d
...@@ -2203,14 +2203,10 @@ _ctl_compat_mpt_command(struct file *file, unsigned cmd, unsigned long arg) ...@@ -2203,14 +2203,10 @@ _ctl_compat_mpt_command(struct file *file, unsigned cmd, unsigned long arg)
karg.data_out_size = karg32.data_out_size; karg.data_out_size = karg32.data_out_size;
karg.max_sense_bytes = karg32.max_sense_bytes; karg.max_sense_bytes = karg32.max_sense_bytes;
karg.data_sge_offset = karg32.data_sge_offset; karg.data_sge_offset = karg32.data_sge_offset;
memcpy(&karg.reply_frame_buf_ptr, &karg32.reply_frame_buf_ptr, karg.reply_frame_buf_ptr = compat_ptr(karg32.reply_frame_buf_ptr);
sizeof(uint32_t)); karg.data_in_buf_ptr = compat_ptr(karg32.data_in_buf_ptr);
memcpy(&karg.data_in_buf_ptr, &karg32.data_in_buf_ptr, karg.data_out_buf_ptr = compat_ptr(karg32.data_out_buf_ptr);
sizeof(uint32_t)); karg.sense_data_ptr = compat_ptr(karg32.sense_data_ptr);
memcpy(&karg.data_out_buf_ptr, &karg32.data_out_buf_ptr,
sizeof(uint32_t));
memcpy(&karg.sense_data_ptr, &karg32.sense_data_ptr,
sizeof(uint32_t));
state = (file->f_flags & O_NONBLOCK) ? NON_BLOCKING : BLOCKING; state = (file->f_flags & O_NONBLOCK) ? NON_BLOCKING : BLOCKING;
return _ctl_do_mpt_command(ioc, karg, &uarg->mf, state); return _ctl_do_mpt_command(ioc, karg, &uarg->mf, state);
} }
......
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