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: <f04b6000-f128-f928-0e3e-e3acc206d2d1@gmail.com>
Date:   Mon, 7 Feb 2022 23:41:49 +0800
From:   Jia-Ju Bai <baijiaju1990@...il.com>
To:     jic23@...nel.org, lars@...afoo.de, valek@...cz,
        gwendal@...omium.org
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [BUG] iio: light: opt3001: possible deadlock in opt3001_read_raw()
 and opt3001_irq()

Hello,

My static analysis tool reports a possible deadlock in the opt3001 
driver in Linux 5.16:

opt3001_read_raw()
   mutex_lock(&opt->lock); --> Line 399 (Lock A)
   opt3001_get_lux()
     wait_event_timeout(opt->result_ready_queue, ...) --> Line 276 (Wait X)
   mutex_lock(&opt->lock); --> Line 412 (Unlock A)

opt3001_irq()
   mutex_lock(&opt->lock); --> Line 693 (Lock A)
   mutex_unlock(&opt->lock); --> Line 730 (Unlock A)
   wake_up(&opt->result_ready_queue); --> Line 733 (Wake X)

When opt3001_read_raw() is executed, "Wait X" is performed by holding 
"Lock A". If opt3001_irq() is executed at this time, "Wake X" cannot be 
performed to wake up "Wait X" in opt3001_read_raw(), because "Lock A" 
has been already hold by opt3001_read_raw(), causing a possible deadlock.
I find that "Wait X" is performed with a timeout, to relieve the 
possible deadlock; but I think this timeout can cause inefficient execution.

I am not quite sure whether this possible problem is real and how to fix 
it if it is real.
Any feedback would be appreciated, thanks :)


Best wishes,
Jia-Ju Bai

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ