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-next>] [day] [month] [year] [list]
Message-ID: <e5806302-9d1b-b262-766a-e64ca9a0159c@ispras.ru>
Date:   Wed, 31 Aug 2016 13:23:39 +0300
From:   Pavel Andrianov <andrianov@...ras.ru>
To:     Jonathan Cameron <jic23@...nel.org>
Cc:     Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Alexander Koch <mail@...xanderkoch.net>,
        Vaishali Thakkar <vaishali.thakkar@...cle.com>,
        ldv-project@...uxtesting.org
Subject: A potential bug in drivers/iio/light/opt3001.ko

Hi!

There is a bug in drivers/iio/light/opt3001.ko. Regard such case:

Thread 1                             Thread 2
-> opt3001_read_raw
   -> mutex_lock(&opt->lock)
   -> opt3001_get_lux()
     ..
     ->i2c_smbus_write_word_swapped()
             Now an interrupt comes
                                      -> opt3001_irq
                                        -> mutex_lock(&opt->lock)

This is a deadlock, as the flag ok_to_ignore_lock has not been set yet.

Regard another case:

Thread 1                             Thread 2
-> opt3001_read_raw
   -> mutex_lock(&opt->lock)
   -> opt3001_get_lux()
     ..
     -> i2c_smbus_write_word_swapped()
     opt->ok_to_ignore_lock = true;
             Now an interrupt comes
                                      -> opt3001_irq
                                        ..
                                        opt->result_ready = true
                                        wake_up()
      opt->result_ready = false;
      wait_event_timeout()

In this case the first thread misses the result and waits until timeout 
expires.

-- 
Pavel Andrianov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: andrianov@...ras.ru

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ