On Tue, 2019-12-17 at 23:16 +0100, Arnd Bergmann wrote:
[...]
> --- a/drivers/scsi/sr.c
> +++ b/drivers/scsi/sr.c
[...]
> @@ -598,6 +599,55 @@ static int sr_block_ioctl(struct block_device *bdev, 
> fmode_t mode, unsigned cmd,
>       return ret;
>  }
>  
> +#ifdef CONFIG_COMPAT
> +static int sr_block_compat_ioctl(struct block_device *bdev, fmode_t mode, 
> unsigned cmd,
> +                       unsigned long arg)
> +{
> +     struct scsi_cd *cd = scsi_cd(bdev->bd_disk);
> +     struct scsi_device *sdev = cd->device;
> +     void __user *argp = compat_ptr(arg);
> +     int ret;
> +
> +     mutex_lock(&sr_mutex);
> +
> +     ret = scsi_ioctl_block_when_processing_errors(sdev, cmd,
> +                     (mode & FMODE_NDELAY) != 0);
> +     if (ret)
> +             goto out;
> +
> +     scsi_autopm_get_device(sdev);
> +
> +     /*
> +      * Send SCSI addressing ioctls directly to mid level, send other
> +      * ioctls to cdrom/block level.
> +      */
> +     switch (cmd) {
> +     case SCSI_IOCTL_GET_IDLUN:
> +     case SCSI_IOCTL_GET_BUS_NUMBER:
> +             ret = scsi_compat_ioctl(sdev, cmd, argp);
> +             goto put;
> +     }
> +
> +     /*
> +      * CDROM ioctls are handled in the block layer, but
> +      * do the scsi blk ioctls here.
> +      */
> +     ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
> +     if (ret != -ENOTTY)
> +             return ret;

This needs to be be "goto put;"

> +     ret = scsi_compat_ioctl(sdev, cmd, argp);
> +
> +put:
> +     scsi_autopm_put_device(sdev);
> +
> +out:
> +     mutex_unlock(&sr_mutex);
> +     return ret;
> +
> +}
> +#endif
[...]

-- 
Ben Hutchings, Software Developer                         Codethink Ltd
https://www.codethink.co.uk/                 Dale House, 35 Dale Street
                                     Manchester, M1 2HF, United Kingdom

_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

Reply via email to