lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALrw=nEgtxS_SDOP5+T0u6XZ74Hcr451L_d5QdUwDHi7ZaLQ6w@mail.gmail.com>
Date:   Mon, 18 Jan 2021 23:05:45 +0000
From:   Ignat Korchagin <ignat@...udflare.com>
To:     Pavel Machek <pavel@...x.de>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        stable@...r.kernel.org,
        "Maciej S. Szmigiero" <mail@...iej.szmigiero.name>,
        Mikulas Patocka <mpatocka@...hat.com>,
        Mike Snitzer <snitzer@...hat.com>
Subject: Re: [PATCH 5.10 045/152] dm crypt: use GFP_ATOMIC when allocating
 crypto requests from softirq

On Mon, Jan 18, 2021 at 10:44 PM Pavel Machek <pavel@...x.de> wrote:
>
>
> > 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!

Good catch! Sorry for the copy-paste. It is actually not a big deal,
because this is not a structure, but a union:
as long as the mempool was initialized with the correct size, it
should be no different.

Nevertheless, I'll send the patch to fix the typo.

Regards,
Ignat

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ