From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E46EC433DB for ; Mon, 18 Jan 2021 22:45:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 47F7B22DD3 for ; Mon, 18 Jan 2021 22:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730808AbhARWpW (ORCPT ); Mon, 18 Jan 2021 17:45:22 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:58442 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732309AbhARWpS (ORCPT ); Mon, 18 Jan 2021 17:45:18 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id AD67C1C0B87; Mon, 18 Jan 2021 23:44:32 +0100 (CET) Date: Mon, 18 Jan 2021 23:44:32 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, "Maciej S. Szmigiero" , Ignat Korchagin , Mikulas Patocka , Mike Snitzer Subject: Re: [PATCH 5.10 045/152] dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq Message-ID: <20210118224431.GA26685@amd> References: <20210118113352.764293297@linuxfoundation.org> <20210118113354.944646657@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k+w/mQv8wyuph6w0" Content-Disposition: inline In-Reply-To: <20210118113354.944646657@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > Fix this by allocating crypto requests with GFP_ATOMIC mask in > interrupt context. =2E.. 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 =3D mempool_alloc(&cc->req_pool, GFP_NOIO); > + if (!ctx->r.req) { > + ctx->r.req =3D mempool_alloc(&cc->req_pool, in_interrupt() ? GFP_ATOMI= C : 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 =3D mempool_alloc(&cc->req_pool, GFP_NOIO); > + if (!ctx->r.req) { > + ctx->r.req =3D mempool_alloc(&cc->req_pool, in_interrupt() ? GFP_ATOMI= C : 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 --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany =20 --k+w/mQv8wyuph6w0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmAGD08ACgkQMOfwapXb+vLfFACbBQYPZfTknkxa850Wi3i5c+9O eyoAoI1ujm1OsqDFVX3i46cIBRXveKpb =eL/i -----END PGP SIGNATURE----- --k+w/mQv8wyuph6w0--