Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1473255
| From | Pavel Andrianov <andrianov@ispras.ru> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | A potential bug in drivers/iio/light/opt3001.ko |
| Date | 2016-08-31 12:30 +0200 |
| Message-ID | <scaWm-1dE-29@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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@ispras.ru
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
A potential bug in drivers/iio/light/opt3001.ko Pavel Andrianov <andrianov@ispras.ru> - 2016-08-31 12:30 +0200
Re: A potential bug in drivers/iio/light/opt3001.ko Jonathan Cameron <jic23@kernel.org> - 2016-09-03 18:40 +0200
Re: A potential bug in drivers/iio/light/opt3001.ko Pavel Andrianov <andrianov@ispras.ru> - 2016-09-05 16:20 +0200
Re: A potential bug in drivers/iio/light/opt3001.ko Jonathan Cameron <jic23@kernel.org> - 2016-09-05 22:10 +0200
csiph-web