Re: [PATCH v5 3/3] s390/crypto: New s390 specific protected key hash phmac

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 22, 2024 at 03:34:27PM +0100, Harald Freudenberger wrote:
>
> +static inline int phmac_keyblob2pkey(const u8 *key, unsigned int keylen,
> +				     struct phmac_protkey *pk)
> +{
> +	int i, rc = -EIO;
> +
> +	/* try three times in case of busy card */
> +	for (i = 0; rc && i < 3; i++) {
> +		if (rc == -EBUSY && msleep_interruptible(1000))
> +			return -EINTR;

You can't sleep in crypto calls in general.

Now there are specific circumstances where sleeping is allowed,
e.g., when the MAY_SLEEP flag is set, but I don't think this will
be acceptable for your purpose.

I see the same problem exists in paes_s390, which was not reviewed
on linux-crypto.

So what exactly causes the EBUSY? The 3 retries followed by failure
seem rather dangerous too given that this could be used by the block
layer for critical data that cannot fail.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux