Message ID | 20190814204259.120942-6-arnd@arndb.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | compat_ioctl.c removal, part 2/3 | expand |
On Wed, Aug 14, 2019 at 10:42:32PM +0200, Arnd Bergmann wrote: > The cpwd_compat_ioctl() contains a bogus mutex that dates > back to a leftover BKL instance. > > Simplify the implementation by using the new compat_ptr_ioctl() > helper function that will do the right thing for all calls > here. > > Note that WIOCSTART/WIOCSTOP don't take any arguments, so > the compat_ptr() conversion is not needed here, but it also > doesn't hurt. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Arnd, On Wed, Aug 14, 2019 at 10:42:32PM +0200, Arnd Bergmann wrote: > The cpwd_compat_ioctl() contains a bogus mutex that dates > back to a leftover BKL instance. > > Simplify the implementation by using the new compat_ptr_ioctl() > helper function that will do the right thing for all calls > here. > > Note that WIOCSTART/WIOCSTOP don't take any arguments, so > the compat_ptr() conversion is not needed here, but it also > doesn't hurt. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > Reviewed-by: Guenter Roeck <linux@roeck-us.net> This patch made it into the kernel, but the infrastructure didn't make it. Do we need to revert it ? Guenter > --- > drivers/watchdog/cpwd.c | 25 +------------------------ > 1 file changed, 1 insertion(+), 24 deletions(-) > > diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c > index b973b31179df..9393be584e72 100644 > --- a/drivers/watchdog/cpwd.c > +++ b/drivers/watchdog/cpwd.c > @@ -473,29 +473,6 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > return 0; > } > > -static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, > - unsigned long arg) > -{ > - int rval = -ENOIOCTLCMD; > - > - switch (cmd) { > - /* solaris ioctls are specific to this driver */ > - case WIOCSTART: > - case WIOCSTOP: > - case WIOCGSTAT: > - mutex_lock(&cpwd_mutex); > - rval = cpwd_ioctl(file, cmd, arg); > - mutex_unlock(&cpwd_mutex); > - break; > - > - /* everything else is handled by the generic compat layer */ > - default: > - break; > - } > - > - return rval; > -} > - > static ssize_t cpwd_write(struct file *file, const char __user *buf, > size_t count, loff_t *ppos) > { > @@ -520,7 +497,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer, > static const struct file_operations cpwd_fops = { > .owner = THIS_MODULE, > .unlocked_ioctl = cpwd_ioctl, > - .compat_ioctl = cpwd_compat_ioctl, > + .compat_ioctl = compat_ptr_ioctl, > .open = cpwd_open, > .write = cpwd_write, > .read = cpwd_read,
On Tue, Oct 8, 2019 at 1:30 AM Guenter Roeck <linux@roeck-us.net> wrote: > > On Wed, Aug 14, 2019 at 10:42:32PM +0200, Arnd Bergmann wrote: > > The cpwd_compat_ioctl() contains a bogus mutex that dates > > back to a leftover BKL instance. > > > > Simplify the implementation by using the new compat_ptr_ioctl() > > helper function that will do the right thing for all calls > > here. > > > > Note that WIOCSTART/WIOCSTOP don't take any arguments, so > > the compat_ptr() conversion is not needed here, but it also > > doesn't hurt. > > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > Reviewed-by: Guenter Roeck <linux@roeck-us.net> > > This patch made it into the kernel, but the infrastructure didn't make it. > Do we need to revert it ? Sorry I had not realized that this patch got queued in the watchdog tree and relied on the other patches. I ended up not sending the series after a runtime regression in another driver, combined with the series not having spent much time in linux-next before the merge window. I've sent a fixup patch now that will make it do the right thing regardless of my series, please apply that for v5.4. Arnd
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index b973b31179df..9393be584e72 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c @@ -473,29 +473,6 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return 0; } -static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) -{ - int rval = -ENOIOCTLCMD; - - switch (cmd) { - /* solaris ioctls are specific to this driver */ - case WIOCSTART: - case WIOCSTOP: - case WIOCGSTAT: - mutex_lock(&cpwd_mutex); - rval = cpwd_ioctl(file, cmd, arg); - mutex_unlock(&cpwd_mutex); - break; - - /* everything else is handled by the generic compat layer */ - default: - break; - } - - return rval; -} - static ssize_t cpwd_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { @@ -520,7 +497,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer, static const struct file_operations cpwd_fops = { .owner = THIS_MODULE, .unlocked_ioctl = cpwd_ioctl, - .compat_ioctl = cpwd_compat_ioctl, + .compat_ioctl = compat_ptr_ioctl, .open = cpwd_open, .write = cpwd_write, .read = cpwd_read,
The cpwd_compat_ioctl() contains a bogus mutex that dates back to a leftover BKL instance. Simplify the implementation by using the new compat_ptr_ioctl() helper function that will do the right thing for all calls here. Note that WIOCSTART/WIOCSTOP don't take any arguments, so the compat_ptr() conversion is not needed here, but it also doesn't hurt. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/watchdog/cpwd.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)