diff options
author | Harald Freudenberger <freude@linux.ibm.com> | 2019-04-03 07:18:22 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2019-04-10 11:46:24 -0400 |
commit | 16222cfb96b02a4a3e38e52012f2a6304850c3c9 (patch) | |
tree | 749688b1dfb6adb9012e241ae4893153957e0b1e | |
parent | 5712f3301a12c0c3de9cc423484496b0464f2faf (diff) |
s390/zcrypt: fix possible deadlock situation on ap queue remove
With commit 01396a374c3d ("s390/zcrypt: revisit ap device remove
procedure") the ap queue remove is now a two stage process. However,
a del_timer_sync() call may trigger the timer function which may
try to lock the very same spinlock as is held by the function
just initiating the del_timer_sync() call. This could end up in
a deadlock situation. Very unlikely but possible as you need to
remove an ap queue at the exact sime time when a timeout of a
request occurs.
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reported-by: Pierre Morel <pmorel@linux.ibm.com>
Fixes: commit 01396a374c3d ("s390/zcrypt: revisit ap device remove procedure")
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/crypto/ap_queue.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/crypto/ap_queue.c b/drivers/s390/crypto/ap_queue.c index 6a340f2c3556..5ea83dc4f1d7 100644 --- a/drivers/s390/crypto/ap_queue.c +++ b/drivers/s390/crypto/ap_queue.c | |||
@@ -751,8 +751,8 @@ void ap_queue_prepare_remove(struct ap_queue *aq) | |||
751 | __ap_flush_queue(aq); | 751 | __ap_flush_queue(aq); |
752 | /* set REMOVE state to prevent new messages are queued in */ | 752 | /* set REMOVE state to prevent new messages are queued in */ |
753 | aq->state = AP_STATE_REMOVE; | 753 | aq->state = AP_STATE_REMOVE; |
754 | del_timer_sync(&aq->timeout); | ||
755 | spin_unlock_bh(&aq->lock); | 754 | spin_unlock_bh(&aq->lock); |
755 | del_timer_sync(&aq->timeout); | ||
756 | } | 756 | } |
757 | 757 | ||
758 | void ap_queue_remove(struct ap_queue *aq) | 758 | void ap_queue_remove(struct ap_queue *aq) |