]> git.baikalelectronics.ru Git - kernel.git/commit
w1: keep balance of mutex locks and refcnts
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Sat, 21 Oct 2017 22:03:44 +0000 (01:03 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Nov 2017 13:26:50 +0000 (14:26 +0100)
commit7bc0a6c4dea902db311f576b9d0098e3a87a914c
tree8681cb2fabc0ae2344c867c885dc55cdccd6696a
parent94a29b21926d9829dd188e7c6f708c3aecf1e195
w1: keep balance of mutex locks and refcnts

w1_therm_eeprom() and w1_DS18B20_precision() decrement THERM_REFCNT
on error paths, while they did not increment it yet.

read_therm() unlocks bus mutex on some error paths,
while it is not acquired.

The patch makes sure all the functions keep the balance in usage of
the mutex and the THERM_REFCNT.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/w1/slaves/w1_therm.c