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>
This commit is contained in:
Arnd Bergmann
2019-12-09 16:33:16 +01:00
parent 8f8f562038
commit ab8bc5417d
2 changed files with 5 additions and 26 deletions

View File

@@ -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,