WSL2-Linux-Kernel/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
..
Makefile
ap_bus.c
ap_bus.h
ap_card.c
ap_debug.h
ap_queue.c
pkey_api.c
vfio_ap_drv.c
vfio_ap_ops.c
vfio_ap_private.h
zcrypt_api.c
zcrypt_api.h
zcrypt_card.c
zcrypt_cca_key.h
zcrypt_ccamisc.c
zcrypt_ccamisc.h
zcrypt_cex2a.c
zcrypt_cex2a.h
zcrypt_cex2c.c
zcrypt_cex2c.h
zcrypt_cex4.c
zcrypt_cex4.h
zcrypt_debug.h
zcrypt_ep11misc.c
zcrypt_ep11misc.h
zcrypt_error.h
zcrypt_msgtype6.c
zcrypt_msgtype6.h
zcrypt_msgtype50.c
zcrypt_msgtype50.h
zcrypt_queue.c