Subject: [PATCH/RFC] [Crypto] Check if ablkcipher->queue field is used.

Evgeniy's hifn driver and probably mine don't use ablkcipher->queue at all.
The show method of ablkcipher will access this field without checking if it
is valid.

Signed-off-by: Sebastian Siewior <[email protected]>
Index: b/crypto/ablkcipher.c
===================================================================
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -91,8 +91,10 @@ static void crypto_ablkcipher_show(struc
seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize);
- seq_printf(m, "qlen : %u\n", ablkcipher->queue->qlen);
- seq_printf(m, "max qlen : %u\n", ablkcipher->queue->max_qlen);
+ if (ablkcipher->queue) {
+ seq_printf(m, "qlen : %u\n", ablkcipher->queue->qlen);
+ seq_printf(m, "max qlen : %u\n", ablkcipher->queue->max_qlen);
+ }
}

const struct crypto_type crypto_ablkcipher_type = {


2007-06-22 11:47:44

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH/RFC] [Crypto] Check if ablkcipher->queue field is used.

On Fri, Jun 08, 2007 at 05:55:51PM +0000, Sebastian Siewior wrote:
> Evgeniy's hifn driver and probably mine don't use ablkcipher->queue at all.
> The show method of ablkcipher will access this field without checking if it
> is valid.
>
> Signed-off-by: Sebastian Siewior <[email protected]>

Actually Evgeniy really needs to have a queue to handle users such
as dm-crypt.

However, I agree with your patch since it is quite valid to not have
a queue, e.g., a load balancer wouldn't need one since it's only
passing the request on.

So patch applied.

Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt