Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2504604pxb; Mon, 18 Jan 2021 21:27:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxHtQRb2grQ2cjrhGsVonWBXn6P6i/NNR0eA9Jyos4sk8HOzJ7IGBrOhuHykdAdU1sqyH3 X-Received: by 2002:a05:6402:11c7:: with SMTP id j7mr1997167edw.290.1611034076328; Mon, 18 Jan 2021 21:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611034076; cv=none; d=google.com; s=arc-20160816; b=rTb7Wiz0cXWAAkxoDU//fyUGa2wDozC/69yUNbwBPY2yfK3/KTwrYeSLmFWTb+kctC peVi896JvDWlaopBumHGjFMCnk6oZtShxmFT6mirBZHln8ZRcS6rPpjzoBJ0T8WeA8NF DdysEvre463z2bbH3LK8l2T9ITmNgdN8EDur6qfZy8hQ84ACtB++4+h34W77rLns/YzQ 5UFwOT8Lhg6ClZS6VOq8PiQaK5GEwtBKzxVLktAY9ZtooPN/FqxRFBw1uiDBbdiTB1pr s2x5ibYaKuTwmVsSugglkpQNRs6sYDtZ8pewOqZyRZ5/fkL4vCB91DQCN+quyz/E/EAy CTFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=wLAg8gJ1ngVaN0OJpggE9vf9mFhJ7Qi3gDjcrBeiFQ8=; b=fWDLJ4RAW4WMwBY7KmOh0f2d31C01PIm69dDvJIGTQVeAWUA7ZuBzwbHBSuHUSpGeA QkEwVMQLg+yeq0wyW+t/ji5u6eQZ3eCvEgOAR9RL6nmIwyc5E9DUyqFpSOsxOkEamPi4 HjLfOkcrEF6Tv2mT2La1l9NBKbnNdmqTtp8VGAgc0P0lknKhtpWY8IJhebOtH1Du4tNS 3zCRZ7gWyQdrBWC+M/+Wr6uSPe6GMOCjXUZ/KsHGUXOnOpVdEy9MyS93+8R5PtMw3iGs WCJOkR8T5ixtidoTmJaIka6gjAHTi9C11nvwqoAZO5kI1yWmt3x/jyhiXORGYJ2YhwH2 QyCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kk2si7425437ejc.735.2021.01.18.21.27.33; Mon, 18 Jan 2021 21:27:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732373AbhARWqS (ORCPT + 99 others); Mon, 18 Jan 2021 17:46:18 -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: linux-kernel@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--