linux/drivers
Arnd Bergmann 98aaaec4a1 compat_ioctl: reimplement SG_IO handling
There are two code locations that implement the SG_IO ioctl: the old
sg.c driver, and the generic scsi_ioctl helper that is in turn used by
multiple drivers.

To eradicate the old compat_ioctl conversion handler for the SG_IO
command, I implement a readable pair of put_sg_io_hdr() /get_sg_io_hdr()
helper functions that can be used for both compat and native mode,
and then I call this from both drivers.

For the iovec handling, there is already a compat_import_iovec() function
that can simply be called in place of import_iovec().

To avoid having to pass the compat/native state through multiple
indirections, I mark the SG_IO command itself as compatible in
fs/compat_ioctl.c and use in_compat_syscall() to figure out where
we are called from.

As a side-effect of this, the sg.c driver now also accepts the 32-bit
sg_io_hdr format in compat mode using the read/write interface, not
just ioctl. This should improve compatiblity with old 32-bit binaries,
but it would break if any application intentionally passes the 64-bit
data structure in compat mode here.

Steffen Maier helped debug an issue in an earlier version of this patch.

Cc: Steffen Maier <maier@linux.ibm.com>
Cc: linux-scsi@vger.kernel.org
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2019-10-23 17:23:46 +02:00
..
accessibility
acpi Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2019-09-28 08:14:15 -07:00
amba ARM updates for 5.4-rc1: 2019-09-22 09:39:09 -07:00
android compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
ata ata: libahci_platform: Add of_node_put() before loop exit 2019-09-19 12:21:44 -06:00
atm atm: he: clean up an indentation issue 2019-09-25 13:54:45 +02:00
auxdisplay It's a somewhat calmer cycle for docs this time, as the churn of the mass 2019-09-17 16:22:26 -07:00
base mm,thp: stats for file backed THP 2019-09-24 15:54:11 -07:00
bcma bcma: make arrays pwr_info_offset and sprom_sizes static const, shrinks object size 2019-09-13 16:44:49 +03:00
block for-linus-2019-10-03 2019-10-04 09:56:51 -07:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-09-15 14:17:27 +02:00
bus ARM: SoC fixes 2019-09-30 10:04:28 -07:00
cdrom
char compat_ioctl: move WDIOC handling into wdt drivers 2019-10-23 17:23:46 +02:00
clk Fixes for omaps for v5.4-rc cycle 2019-10-03 09:15:19 -07:00
clocksource timer-of: don't use conditional expression with mixed 'void' types 2019-10-02 16:16:07 -07:00
connector
counter
cpufreq Power management updates for 5.4-rc1 2019-09-17 19:15:14 -07:00
cpuidle Power management updates for 5.4-rc1 2019-09-17 19:15:14 -07:00
crypto compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
dax
dca
devfreq
dio
dma Main MIPS changes for v5.4: 2019-09-22 09:30:30 -07:00
dma-buf compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
edac ARM updates for 5.4-rc1: 2019-09-22 09:39:09 -07:00
eisa
extcon chrome platform changes for v5.4 2019-09-19 14:14:28 -07:00
firewire compat_ioctl: move drivers to compat_ptr_ioctl 2019-10-23 17:23:43 +02:00
firmware ARM: SoC fixes 2019-09-30 10:04:28 -07:00
fpga Char/Misc driver patches for 5.4-rc1 2019-09-18 11:14:31 -07:00
fsi
gnss
gpio pwm: Changes for v5.4-rc1 2019-09-27 12:19:47 -07:00
gpu compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
greybus
hid compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
hsi HSI changes for the 5.4 series 2019-09-22 12:02:21 -07:00
hv - First round of vmbus hibernation support from Dexuan Cui. 2019-09-24 12:36:31 -07:00
hwmon compat_ioctl: move WDIOC handling into wdt drivers 2019-10-23 17:23:46 +02:00
hwspinlock
hwtracing compat_ioctl: move drivers to compat_ptr_ioctl 2019-10-23 17:23:43 +02:00
i2c i2c: slave-eeprom: Add read only mode 2019-09-28 20:44:12 +02:00
i3c
ide compat_ioctl: move tape handling into drivers 2019-10-23 17:23:44 +02:00
idle
iio compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
infiniband compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
input chrome platform changes for v5.4 2019-09-19 14:14:28 -07:00
interconnect
iommu IOMMU Fixes for Linux v5.4-rc1 2019-09-29 10:00:14 -07:00
ipack
irqchip Main MIPS changes for v5.4: 2019-09-22 09:30:30 -07:00
isdn compat_ioctl: move isdn/capi ioctl translation into driver 2019-10-23 17:23:44 +02:00
leds leds: lm3532: Fix optional led-max-microamp prop error handling 2019-09-12 20:45:52 +02:00
lightnvm
macintosh
mailbox mailbox: qcom-apcs: fix max_register value 2019-09-17 00:54:29 -05:00
mcb
md for-5.4/post-2019-09-24 2019-09-24 16:31:50 -07:00
media compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
memory
memstick ms_block: fix spelling mistake "randomally" -> "randomly" 2019-09-11 16:11:01 +02:00
message
mfd Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal 2019-09-29 10:24:23 -07:00
misc compat_ioctl: use correct compat_ptr() translation in drivers 2019-10-23 17:23:44 +02:00
mmc mmc: host: sdhci-pci: Add Genesys Logic GL975x support 2019-09-27 20:48:20 +02:00
mtd compat_ioctl: move drivers to compat_ptr_ioctl 2019-10-23 17:23:43 +02:00
mux
net compat_ioctl: move drivers to compat_ptr_ioctl 2019-10-23 17:23:43 +02:00
nfc NFC: st95hf: clean up indentation issue 2019-09-27 20:31:18 +02:00
ntb NTB: fix IDT Kconfig typos/spellos 2019-09-23 17:20:40 -04:00
nubus
nvdimm compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
nvme compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
nvmem Char/Misc driver patches for 5.4-rc1 2019-09-18 11:14:31 -07:00
of Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-09-28 17:47:33 -07:00
opp
oprofile
parisc dma-mapping updates for 5.4: 2019-09-19 13:27:23 -07:00
parport Char/Misc driver patches for 5.4-rc1 2019-09-18 11:14:31 -07:00
pci compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
pcmcia Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2019-09-28 08:14:15 -07:00
perf
phy pci-v5.4-changes 2019-09-23 19:16:01 -07:00
pinctrl This is the bulk of pin control changes for the v5.4 kernel 2019-09-19 14:19:33 -07:00
platform compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
pnp
power power supply and reset changes for the v5.4 series 2019-09-22 12:04:59 -07:00
powercap Power management updates for 5.4-rc1 2019-09-17 19:15:14 -07:00
pps
ps3
ptp ptp_qoriq: Initialize the registers' spinlock before calling ptp_qoriq_settime 2019-10-02 12:20:38 -04:00
pwm pwm: Changes for v5.4-rc1 2019-09-27 12:19:47 -07:00
rapidio
ras
regulator LED updates for 5.4-rc1 2019-09-17 18:40:42 -07:00
remoteproc remoteproc updates for v5.4 2019-09-22 10:55:08 -07:00
reset ARM: SoC fixes 2019-09-30 10:04:28 -07:00
rpmsg compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
rtc compat_ioctl: move WDIOC handling into wdt drivers 2019-10-23 17:23:46 +02:00
s390 compat_ioctl: move tape handling into drivers 2019-10-23 17:23:44 +02:00
sbus compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
scsi compat_ioctl: reimplement SG_IO handling 2019-10-23 17:23:46 +02:00
sfi
sh
siox
slimbus
soc ARM: SoC driver updates for v5.4 2019-09-16 15:52:38 -07:00
soundwire soundwire updates for v5.4-rc1 2019-09-22 10:52:23 -07:00
spi LED updates for 5.4-rc1 2019-09-17 18:40:42 -07:00
spmi
ssb ssb: make array pwr_info_offset static const, makes object smaller 2019-09-13 17:23:18 +03:00
staging compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
target mm: introduce page_size() 2019-09-24 15:54:08 -07:00
tc
tee compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
thermal Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal 2019-09-29 10:24:23 -07:00
thunderbolt
tty Merge branch 'next-lockdown' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2019-09-28 08:14:15 -07:00
uio Char/Misc driver patches for 5.4-rc1 2019-09-18 11:14:31 -07:00
usb compat_ioctl: use correct compat_ptr() translation in drivers 2019-10-23 17:23:44 +02:00
vfio compat_ioctl: move drivers to compat_ptr_ioctl 2019-10-23 17:23:43 +02:00
vhost compat_ioctl: move drivers to compat_ptr_ioctl 2019-10-23 17:23:43 +02:00
video compat_ioctl: move ATYFB_CLK handling to atyfb driver 2019-10-23 17:23:44 +02:00
virt compat_ioctl: move more drivers to compat_ptr_ioctl 2019-10-23 17:23:44 +02:00
virtio
visorbus
vlynq
vme
w1
watchdog compat_ioctl: move WDIOC handling into wdt drivers 2019-10-23 17:23:46 +02:00
xen xen: fixes and cleanups for 5.4-rc2 2019-10-04 11:13:09 -07:00
zorro
Kconfig Staging/IIO driver patches for 5.4-rc1 2019-09-18 11:05:34 -07:00
Makefile Staging/IIO driver patches for 5.4-rc1 2019-09-18 11:05:34 -07:00