[SCSI] compat_ioct: fix bsg SG_IO

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>

authored by FUJITA Tomonori and committed by James Bottomley 84eb8fb4 0f19bc68

+6
+6
fs/compat_ioctl.c
··· 301 u32 data; 302 void __user *dxferp; 303 int err; 304 305 if (get_user(iovec_count, &sgio32->iovec_count)) 306 return -EFAULT;
··· 301 u32 data; 302 void __user *dxferp; 303 int err; 304 + int interface_id; 305 + 306 + if (get_user(interface_id, &sgio32->interface_id)) 307 + return -EFAULT; 308 + if (interface_id != 'S') 309 + return sys_ioctl(fd, cmd, (unsigned long)sgio32); 310 311 if (get_user(iovec_count, &sgio32->iovec_count)) 312 return -EFAULT;