]> git.baikalelectronics.ru Git - kernel.git/commit
s390/zcrypt: return EIO when msg retry limit reached
authorHarald Freudenberger <freude@linux.ibm.com>
Thu, 21 Jan 2021 15:03:08 +0000 (16:03 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 9 Feb 2021 14:57:04 +0000 (15:57 +0100)
commit4b47a14ac0a9c1d9775217072e406a1ef97e1f40
tree00b093729965cea2d471653c9fc7c6ce7ebd078d
parentbaad6a0482aff7904efd540dd001526cbd8c3373
s390/zcrypt: return EIO when msg retry limit reached

When a msg is retried because the lower ap layer returns -EAGAIN
there is a retry limit (currently 10). When this limit is reached
the last return code from the lower layer is returned, causing
the userspace to get -1 on the ioctl with errno EAGAIN.

This EAGAIN is misleading here. After 10 retry attempts the
userspace should receive a clear failure indication like EINVAL
or EIO or ENODEV. However, the reason why these retries all
fail is unclear. On an invalid message EINVAL would be returned
by the lower layer, and if devices go away or are not available
an ENODEV is seen. So this patch now reworks the retry loops
to return EIO to userspace when the retry limit is reached.

Fixes: b13625cd9a61 ("s390/zcrypt: introduce msg tracking in zcrypt functions")
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
drivers/s390/crypto/zcrypt_api.c