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: <20200425170912.17c3435a@archlinux>
Date:   Sat, 25 Apr 2020 17:09:12 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Mathieu Othacehe <m.othacehe@...il.com>
Cc:     Andy Shevchenko <andy.shevchenko@...il.com>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald <pmeerw@...erw.net>,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 4/4] iio: vcnl4000: Add buffer support for
 VCNL4010/20.

On Wed, 22 Apr 2020 10:14:21 +0200
Mathieu Othacehe <m.othacehe@...il.com> wrote:

> >> +static int vcnl4010_buffer_predisable(struct iio_dev *indio_dev)
> >> +{
> >> +       struct vcnl4000_data *data = iio_priv(indio_dev);
> >> +       int ret, ret_disable;
> >> +
> >> +       ret = i2c_smbus_write_byte_data(data->client, VCNL4010_INT_CTRL, 0);
> >> +       if (ret < 0)
> >> +               goto end;
> >> +
> >> +       ret = i2c_smbus_write_byte_data(data->client, VCNL4000_COMMAND, 0);
> >> +
> >> +end:  
> >  
> >> +       ret_disable = iio_triggered_buffer_predisable(indio_dev);
> >> +       if (ret == 0)
> >> +               ret = ret_disable;  
> >
> > What is this?
> >
> > Can't you rather call IIO API first, and then try to handle the rest?  
> 
> Well, iio_triggered_buffer_predisable will call free_irq which requires
> that the interruption source is disabled, hence this strange pattern.
> 
> However, this may be some misunderstanding from me, but I noticed
> something strange here. In a configuration with one CPU and
> CONFIG_PREEMPT disabled, I have kernel lockups when disabling the
> buffer.
> 
> This is because free_irq calls synchronize_irq that will wait for any
> IRQ handler to be over. If the kthread handling the interruption is
> still running, it has no chances to terminate, and synchronize_irq waits
> forever. So maybe I'm missing something.

That is indeed worrying.  The synchronize_irq is documented as
sleeping if we have a threaded interrupt.  From a quick look I'd have
expected the wait in there to result in the interrupt thread being able
to complete whether or not we had preemption enabled.

I wonder what I'm missing...

Jonathan


> 
> Anyway, I'll send a v5 addressing your remarks.
> 
> Thanks,
> 
> Mathieu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ