scsi: megaraid_sas: Simplify compat_ioctl handling
authorArnd Bergmann <arnd@arndb.de>
Fri, 30 Oct 2020 16:44:21 +0000 (17:44 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 5 Nov 2020 02:56:17 +0000 (21:56 -0500)
commitbba84aeccafb57f3f175bbab0658a7facd611d18
tree2098b42207d478584b8b17d04fe2f87c6fe592ab
parent381d34e376e3d9d27730fda8a0e870600e6c8196
scsi: megaraid_sas: Simplify compat_ioctl handling

There have been several attempts to fix serious problems in the compat
handling in megasas_mgmt_compat_ioctl_fw(), and it also uses the
compat_alloc_user_space() function.

Folding the compat handling into the regular ioctl function with
in_compat_syscall() simplifies it a lot and avoids some of the remaining
problems:

 - missing handling of unaligned pointers

 - overflowing the ioc->frame.raw array from invalid input

 - compat_alloc_user_space()

Link: https://lore.kernel.org/r/20201030164450.1253641-3-arnd@kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/megaraid/megaraid_sas_base.c