diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2009-12-16 08:23:04 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-02-08 19:19:40 -0500 |
commit | 22c88425e03e8476176375ab0457c88ff3a5b68c (patch) | |
tree | 66b41c53bf3d5896393bc70322f45d7894807bb0 | |
parent | e75b9b6d9d81e35aed5ef2692285c4948e173c5c (diff) |
[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: Kashyap Desai <kashyap.desai@lsi.com>
Reviewed-by: Eric Moore <eric.moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_ctl.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index 198ecdd849a4..fa9bf83819d5 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c | |||
@@ -2203,14 +2203,10 @@ _ctl_compat_mpt_command(struct file *file, unsigned cmd, unsigned long arg) | |||
2203 | karg.data_out_size = karg32.data_out_size; | 2203 | karg.data_out_size = karg32.data_out_size; |
2204 | karg.max_sense_bytes = karg32.max_sense_bytes; | 2204 | karg.max_sense_bytes = karg32.max_sense_bytes; |
2205 | karg.data_sge_offset = karg32.data_sge_offset; | 2205 | karg.data_sge_offset = karg32.data_sge_offset; |
2206 | memcpy(&karg.reply_frame_buf_ptr, &karg32.reply_frame_buf_ptr, | 2206 | karg.reply_frame_buf_ptr = compat_ptr(karg32.reply_frame_buf_ptr); |
2207 | sizeof(uint32_t)); | 2207 | karg.data_in_buf_ptr = compat_ptr(karg32.data_in_buf_ptr); |
2208 | memcpy(&karg.data_in_buf_ptr, &karg32.data_in_buf_ptr, | 2208 | karg.data_out_buf_ptr = compat_ptr(karg32.data_out_buf_ptr); |
2209 | sizeof(uint32_t)); | 2209 | karg.sense_data_ptr = compat_ptr(karg32.sense_data_ptr); |
2210 | memcpy(&karg.data_out_buf_ptr, &karg32.data_out_buf_ptr, | ||
2211 | sizeof(uint32_t)); | ||
2212 | memcpy(&karg.sense_data_ptr, &karg32.sense_data_ptr, | ||
2213 | sizeof(uint32_t)); | ||
2214 | state = (file->f_flags & O_NONBLOCK) ? NON_BLOCKING : BLOCKING; | 2210 | state = (file->f_flags & O_NONBLOCK) ? NON_BLOCKING : BLOCKING; |
2215 | return _ctl_do_mpt_command(ioc, karg, &uarg->mf, state); | 2211 | return _ctl_do_mpt_command(ioc, karg, &uarg->mf, state); |
2216 | } | 2212 | } |