linux_dsm_epyc7002/drivers/s390/crypto
Harald Freudenberger b516daed99 s390/ap: Fix hanging ioctl caused by wrong msg counter
commit e73a99f3287a740a07d6618e9470f4d6cb217da8 upstream.

When a AP queue is switched to soft offline, all pending
requests are purged out of the pending requests list and
'received' by the upper layer like zcrypt device drivers.
This is also done for requests which are already enqueued
into the firmware queue. A request in a firmware queue
may eventually produce an response message, but there is
no waiting process any more. However, the response was
counted with the queue_counter and as this counter was
reset to 0 with the offline switch, the pending response
caused the queue_counter to get negative. The next request
increased this counter to 0 (instead of 1) which caused
the ap code to assume there is nothing to receive and so
the response for this valid request was never tried to
fetch from the firmware queue.

This all caused a queue to not work properly after a
switch offline/online and in the end processes to hang
forever when trying to send a crypto request after an
queue offline/online switch cicle.

Fixed by a) making sure the counter does not drop below 0
and b) on a successful enqueue of a message has at least
a value of 1.

Additionally a warning is emitted, when a reply can't get
assigned to a waiting process. This may be normal operation
(process had timeout or has been killed) but may give a
hint that something unexpected happened (like this odd
behavior described above).

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-06-23 14:42:51 +02:00
..
ap_bus.c
ap_bus.h
ap_card.c
ap_debug.h
ap_queue.c s390/ap: Fix hanging ioctl caused by wrong msg counter 2021-06-23 14:42:51 +02:00
Makefile
pkey_api.c
vfio_ap_drv.c
vfio_ap_ops.c s390/crypto: return -EFAULT if copy_to_user() fails 2021-03-17 17:06:19 +01:00
vfio_ap_private.h
zcrypt_api.c
zcrypt_api.h
zcrypt_card.c s390/zcrypt: fix zcard and zqueue hot-unplug memleak 2021-05-11 14:47:11 +02:00
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 s390/zcrypt: fix zcard and zqueue hot-unplug memleak 2021-05-11 14:47:11 +02:00