Re: [PATCH 5.10 045/152] dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq

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

 



> Fix this by allocating crypto requests with GFP_ATOMIC mask in
> interrupt context.
...

This one is wrong.


> +++ b/drivers/md/dm-crypt.c
> @@ -1454,13 +1454,16 @@ static int crypt_convert_block_skcipher(
> -	if (!ctx->r.req)
> -		ctx->r.req = mempool_alloc(&cc->req_pool, GFP_NOIO);
> +	if (!ctx->r.req) {
> +		ctx->r.req = mempool_alloc(&cc->req_pool, in_interrupt() ? GFP_ATOMIC : GFP_NOIO);

Good so far. Ugly but good.

> -static void crypt_alloc_req_aead(struct crypt_config *cc,
> +static int crypt_alloc_req_aead(struct crypt_config *cc,
>  				 struct convert_context *ctx)
>  {
> -	if (!ctx->r.req_aead)
> -		ctx->r.req_aead = mempool_alloc(&cc->req_pool, GFP_NOIO);
> +	if (!ctx->r.req) {
> +		ctx->r.req = mempool_alloc(&cc->req_pool, in_interrupt() ? GFP_ATOMIC : GFP_NOIO);
> +		if (!ctx->r.req)
> +			return -ENOMEM;
> +	}

But this one can't be good. We are now allocating different field in
the structure!

								Pavel

-- 
DENX Software Engineering GmbH,      Managing Director:    Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194    Groebenzell, Germany
    

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux