lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a3W+5RTa5jTunotZyV=hgXTxJaPqz_5kJnsdbvSZZPmjg@mail.gmail.com>
Date:   Thu, 19 Dec 2019 13:15:02 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Ben Hutchings <ben.hutchings@...ethink.co.uk>
Cc:     Jens Axboe <axboe@...nel.dk>,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        linux-scsi <linux-scsi@...r.kernel.org>,
        linux-block <linux-block@...r.kernel.org>,
        y2038 Mailman List <y2038@...ts.linaro.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Christoph Hellwig <hch@....de>,
        "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
        Jonathan Corbet <corbet@....net>,
        Al Viro <viro@...iv.linux.org.uk>,
        Linux FS-devel Mailing List <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH v2 21/27] compat_ioctl: move cdrom commands into cdrom.c

On Wed, Dec 18, 2019 at 9:11 PM Ben Hutchings
<ben.hutchings@...ethink.co.uk> wrote:
>
> On Tue, 2019-12-17 at 23:17 +0100, Arnd Bergmann wrote:
> [...]
> > @@ -1710,6 +1711,38 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
> >       return ret;
> >  }
> >
> > +#ifdef CONFIG_COMPAT
> > +static int idecd_locked_compat_ioctl(struct block_device *bdev, fmode_t mode,
> > +                     unsigned int cmd, unsigned long arg)
> > +{
> > +     struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info);
> > +     int err;
> > +
> > +     switch (cmd) {
> > +     case CDROMSETSPINDOWN:
> > +             return idecd_set_spindown(&info->devinfo, arg);
> > +     case CDROMGETSPINDOWN:
> > +             return idecd_get_spindown(&info->devinfo, arg);
>
> compat_ptr() should also be applied to the argument for these two
> commands, though I'm fairly sure IDE drivers have never been useful on
> s390 so it doesn't matter in practice.

Agreed on both, fixed by folding in this change:

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 2de6e8ace957..e09b949a7c46 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1716,19 +1716,20 @@ static int idecd_locked_compat_ioctl(struct
block_device *bdev, fmode_t mode,
                        unsigned int cmd, unsigned long arg)
 {
        struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info);
+       void __user *argp = compat_ptr(arg);
        int err;

        switch (cmd) {
        case CDROMSETSPINDOWN:
-               return idecd_set_spindown(&info->devinfo, arg);
+               return idecd_set_spindown(&info->devinfo, (unsigned long)argp);
        case CDROMGETSPINDOWN:
-               return idecd_get_spindown(&info->devinfo, arg);
+               return idecd_get_spindown(&info->devinfo, (unsigned long)argp);
        default:
                break;
        }

        return cdrom_ioctl(&info->devinfo, bdev, mode, cmd,
-                          (unsigned long)compat_ptr(arg));
+                          (unsigned long)argp);
 }

static int idecd_compat_ioctl(struct block_device *bdev, fmode_t mode,

Unfortunately the generic_ide_ioctl() call still needs an unconverted arg,
so I can't just use compat_ptr() to call the native idecd_locked_ioctl()
for all commands.

Thanks,

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ