Skip to content

Commit

Permalink
[SCSI] compat_ioct: fix bsg SG_IO
Browse files Browse the repository at this point in the history
bsg's SG_IO doesn't work on 32-bit userspace and 64-bit kernelspace.

The problem is that both sg and bsg drivers use SG_IO
ioctl. sg_ioctl_trans() does 32/64-bit conversion even against bsg
header. It messes up bsg header. bsg driver gets garbage.

This patch fixes sg_ioctl_trans to handle only sg header (struct
sg_io_hdr).

Reported-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Feb 8, 2010
1 parent 0f19bc6 commit 84eb8fb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/compat_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd,
u32 data;
void __user *dxferp;
int err;
int interface_id;

if (get_user(interface_id, &sgio32->interface_id))
return -EFAULT;
if (interface_id != 'S')
return sys_ioctl(fd, cmd, (unsigned long)sgio32);

if (get_user(iovec_count, &sgio32->iovec_count))
return -EFAULT;
Expand Down

0 comments on commit 84eb8fb

Please sign in to comment.