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: <CAFEvwukjrxjPj5wUAv1ngCyu3yHPRqeOiB8ActopkQ4rfv7T0Q@mail.gmail.com>
Date:   Sun, 25 Oct 2020 01:46:02 +0530
From:   harshal chaudhari <harshalchau04@...il.com>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     David Laight <David.Laight@...lab.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        Sudip Mukherjee <sudipm.mukherjee@...il.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] char: ppdev: check if ioctl argument is present and valid

On Sun, Oct 25, 2020 at 12:51 AM Arnd Bergmann <arnd@...nel.org> wrote:
>
> On Sat, Oct 24, 2020 at 5:54 PM harshal chaudhari
> <harshalchau04@...il.com> wrote:
> > On Tue, Oct 13, 2020 at 4:42 PM David Laight <David.Laight@...lab.com> wrote:
>
> > So I am a little bit confused about this check whether it's required or not
> > Please could you point me in the right direction?
> >
> > In any case, thanks for your help ...
> >
> > Here is a driver source located in: linux/drivers/misc/xilinx_sdfec.c
> >
> > static long xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd,
> > unsigned long data)
> > {
> > struct xsdfec_dev *xsdfec;
> > void __user *arg = NULL;
> > int rval = -EINVAL;
> >
> > if (_IOC_TYPE(cmd) != XSDFEC_MAGIC)
> >                return -ENOTTY;
> >
> > /* check if ioctl argument is present and valid */
> > if (_IOC_DIR(cmd) != _IOC_NONE)
> > {
> >         arg = (void __user *)data;
> >         if (!arg)
> >                    return rval;
> > }
> >
>
> All of this can be removed, and replaced with unconditional
>
>      void __user *arg = (void __user *)data;
>      int rval;
>
> with an "rval = -ENOTTY" added in the 'default' case. This will
> make it behave more like other drivers, returning -ENOTTY for
> any unknown ioctl command, and returning -EFAULT for all
> invalid pointers, including NULL.
>
> xsdfec_dev_compat_ioctl() can removed as well, with the file operations
> changed to an unconditional (removing the #ifdef)
>
>       .compat_ioctl = compat_ptr_ioctl(),
>
> This will not affect behavior, it's just another simplification.

Thanks a lot Arnd. Got the point. and i will make the change
and i will send it to relevant maintainers of that driver file.

Once again thanks!

>           Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ