diff options
author | Arnd Bergmann <arnd@arndb.de> | 2019-12-09 16:33:16 +0100 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2020-01-03 09:33:11 +0100 |
commit | ab8bc5417d8cf62a5fc515737b391689573e7fb3 (patch) | |
tree | 4101c5e66210bb085e2deae013e12998d7f370e0 /drivers/cdrom | |
parent | 8f8f562038c188046d683e2b650f7731739869dd (diff) | |
download | linux-ab8bc5417d8cf62a5fc515737b391689573e7fb3.tar.gz linux-ab8bc5417d8cf62a5fc515737b391689573e7fb3.tar.bz2 linux-ab8bc5417d8cf62a5fc515737b391689573e7fb3.zip |
compat_ioctl: cdrom: handle CDROM_LAST_WRITTEN
This is the only ioctl command that does not have a proper
compat handler. Making the normal implementation do the
right thing is actually very simply, so just do that by
using an in_compat_syscall() check to avoid the special
case in the pkcdvd driver.
Reviewed-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/cdrom')
-rw-r--r-- | drivers/cdrom/cdrom.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 48095025e588..faca0f346fff 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -3293,9 +3293,10 @@ static noinline int mmc_ioctl_cdrom_last_written(struct cdrom_device_info *cdi, ret = cdrom_get_last_written(cdi, &last); if (ret) return ret; - if (copy_to_user((long __user *)arg, &last, sizeof(last))) - return -EFAULT; - return 0; + if (in_compat_syscall()) + return put_user(last, (__s32 __user *)arg); + + return put_user(last, (long __user *)arg); } static int mmc_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, |