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: <CAA+rx9TfvFH2JaCcD6OCjB3f1iUWrMgTZCwuOBUUuVP8HUitgA@mail.gmail.com>
Date:   Sat, 21 Jan 2017 09:49:15 +0100
From:   Vlad Dogaru <ddvlad@...il.com>
To:     Alison Schofield <amsfield22@...il.com>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>, lars@...afoo.de,
        pmeerw@...erw.net, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: proximity: sx9500: claim direct mode during raw
 proximity reads

On Fri, Jan 20, 2017 at 11:11 PM, Alison Schofield <amsfield22@...il.com> wrote:
> Driver was checking for direct mode but not locking it.  Use the
> claim/release helper functions to guarantee the device stays in
> direct mode during raw reads of proximity data.
>
> Signed-off-by: Alison Schofield <amsfield22@...il.com>

Reviewed-by: Vlad Dogaru <ddvlad@...il.com>

> ---
>  drivers/iio/proximity/sx9500.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
> index 1f06282..9ea147f 100644
> --- a/drivers/iio/proximity/sx9500.c
> +++ b/drivers/iio/proximity/sx9500.c
> @@ -387,14 +387,18 @@ static int sx9500_read_raw(struct iio_dev *indio_dev,
>                            int *val, int *val2, long mask)
>  {
>         struct sx9500_data *data = iio_priv(indio_dev);
> +       int ret;
>
>         switch (chan->type) {
>         case IIO_PROXIMITY:
>                 switch (mask) {
>                 case IIO_CHAN_INFO_RAW:
> -                       if (iio_buffer_enabled(indio_dev))
> -                               return -EBUSY;
> -                       return sx9500_read_proximity(data, chan, val);
> +                       ret = iio_device_claim_direct_mode(indio_dev);
> +                       if (ret)
> +                               return ret;
> +                       ret = sx9500_read_proximity(data, chan, val);
> +                       iio_device_release_direct_mode(indio_dev);
> +                       return ret;
>                 case IIO_CHAN_INFO_SAMP_FREQ:
>                         return sx9500_read_samp_freq(data, val, val2);
>                 default:
> --
> 2.1.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ