diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2017-04-30 17:33:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-25 14:30:08 +0200 |
commit | 5d1df36c9d2c90cfebdc74b8d8f4121ddab07022 (patch) | |
tree | f92718d898752801a7d33cc91e5d14ab8c0ed09d /drivers/hwmon/lm85.c | |
parent | 4df4bf1df91680ef4f0c718a57a8371b56895347 (diff) |
dm bufio: avoid a possible ABBA deadlock
commit 1b0fb5a5b2dc0dddcfa575060441a7176ba7ac37 upstream.
__get_memory_limit() tests if dm_bufio_cache_size changed and calls
__cache_size_refresh() if it did. It takes dm_bufio_clients_lock while
it already holds the client lock. However, lock ordering is violated
because in cleanup_old_buffers() dm_bufio_clients_lock is taken before
the client lock.
This results in a possible deadlock and lockdep engine warning.
Fix this deadlock by changing mutex_lock() to mutex_trylock(). If the
lock can't be taken, it will be re-checked next time when a new buffer
is allocated.
Also add "unlikely" to the if condition, so that the optimizer assumes
that the condition is false.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwmon/lm85.c')
0 files changed, 0 insertions, 0 deletions