linux-stable/drivers/s390/crypto
Harald Freudenberger 3ef2272417 s390/ap: Fix hanging ioctl caused by orphaned replies
commit 3826350e6d upstream.

When a queue is switched to soft offline during heavy load and later
switched to soft online again and now used, it may be that the caller
is blocked forever in the ioctl call.

The failure occurs because there is a pending reply after the queue(s)
have been switched to offline. This orphaned reply is received when
the queue is switched to online and is accidentally counted for the
outstanding replies. So when there was a valid outstanding reply and
this orphaned reply is received it counts as the outstanding one thus
dropping the outstanding counter to 0. Voila, with this counter the
receive function is not called any more and the real outstanding reply
is never received (until another request comes in...) and the ioctl
blocks.

The fix is simple. However, instead of readjusting the counter when an
orphaned reply is detected, I check the queue status for not empty and
compare this to the outstanding counter. So if the queue is not empty
then the counter must not drop to 0 but at least have a value of 1.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-18 19:17:17 +01:00
..
ap_bus.c s390/ap: fix kernel doc comments 2021-09-15 14:29:21 +02:00
ap_bus.h s390/ap: fix state machine hang after failure to enable irq 2021-08-26 20:22:12 +02:00
ap_card.c s390/AP: support new dynamic AP bus size limit 2021-07-05 12:44:23 +02:00
ap_debug.h s390/ap: add error response code field for ap queue devices 2020-10-07 21:50:00 +02:00
ap_queue.c s390/ap: Fix hanging ioctl caused by orphaned replies 2021-11-18 19:17:17 +01:00
Makefile
pkey_api.c s390/zcrypt/pkey: introduce zcrypt_wait_api_operational() function 2020-11-09 11:21:00 +01:00
vfio_ap_drv.c s390/vfio-ap: clean up vfio_ap_drv's definition 2021-06-07 17:07:00 +02:00
vfio_ap_ops.c vfio/ap_ops: Add missed vfio_uninit_group_dev() 2021-09-24 10:04:44 -06:00
vfio_ap_private.h vfio/ap_ops: Convert to use vfio_register_group_dev() 2021-08-25 12:43:46 -06:00
zcrypt_api.c s390/zcrypt: remove incorrect kernel doc indicators 2021-09-08 14:23:31 +02:00
zcrypt_api.h s390/ap/zcrypt: notify userspace with online, config and mode info 2021-06-16 23:46:18 +02:00
zcrypt_card.c s390/ap: use the common driver-data pointer 2021-08-25 11:03:32 +02:00
zcrypt_cca_key.h
zcrypt_ccamisc.c s390/zcrypt: fix wrong offset index for APKA master key valid state 2021-08-18 10:01:28 +02:00
zcrypt_ccamisc.h s390/crypto: fix function/prototype mismatches 2021-06-07 17:06:58 +02:00
zcrypt_cex2a.c s390/zcrypt: remove incorrect kernel doc indicators 2021-09-08 14:23:31 +02:00
zcrypt_cex2a.h
zcrypt_cex2c.c s390/zcrypt: remove incorrect kernel doc indicators 2021-09-08 14:23:31 +02:00
zcrypt_cex2c.h
zcrypt_cex4.c s390/zcrypt: remove incorrect kernel doc indicators 2021-09-08 14:23:31 +02:00
zcrypt_cex4.h
zcrypt_debug.h s390/ap/zcrypt: revisit ap and zcrypt error handling 2020-10-07 21:50:01 +02:00
zcrypt_ep11misc.c s390/pkey: support CCA and EP11 secure ECC private keys 2020-09-24 10:03:28 +02:00
zcrypt_ep11misc.h s390/pkey: support CCA and EP11 secure ECC private keys 2020-09-24 10:03:28 +02:00
zcrypt_error.h s390/ap/zcrypt: revisit ap and zcrypt error handling 2020-10-07 21:50:01 +02:00
zcrypt_msgtype6.c s390/zcrypt: remove incorrect kernel doc indicators 2021-09-08 14:23:31 +02:00
zcrypt_msgtype6.h s390/AP: support new dynamic AP bus size limit 2021-07-05 12:44:23 +02:00
zcrypt_msgtype50.c s390/zcrypt: remove incorrect kernel doc indicators 2021-09-08 14:23:31 +02:00
zcrypt_msgtype50.h
zcrypt_queue.c s390/ap: use the common driver-data pointer 2021-08-25 11:03:32 +02:00