Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3061154pxb; Tue, 19 Jan 2021 12:42:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwO9yfRgkvnVpydPDCvF3WopeX9K5ASh+Aud80Ps4A6YDOTRnurHyI+iTkBfDPsWWHIeRZI X-Received: by 2002:a17:906:a48:: with SMTP id x8mr4052127ejf.444.1611088969234; Tue, 19 Jan 2021 12:42:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611088969; cv=none; d=google.com; s=arc-20160816; b=fgseMEh+yD0/cVlTVBMh/Uu36z+yBz9x0I65bP/NRoMn0kN4xFlqZYm98B9sz78WDa oeVFyMyceeyrfJvbO004rNUjnIUT0pLlU4BHHAwFF2gRjXeqYZbCIXoVSfu7p/M03OkL c1j9f1+qO4aGEiBA0DY1Lps0hjEEO53FHZrWYUQEO9zHOPg/4Sn5s6uVTuiKvlu4n5og tsx9P59ThEzVkNSvk0SDUmdB+WNJtA91BsQqa4S8EhEuX1WEQEt7r4vfoGjvAUuuCrl0 aBtmffTJ98gvb4cnIO0vjhjK+c8xtyqxDlZiBdtaJrDa7C7yHvHnTlcN1blJucgGKSoE Rh+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Hqz5KkIUWAsMMr4Nkw2DHVorD8Rmr14UkHNWJhlYZr4=; b=GqcgC20f5y3JvzCMpR5pWQ9ZRBEP7VJCdEiSRfGGLdp4K2qNj8waFsxoj1yKqqeFZV Yrq+uTMeLf9vS1+wIYjJ6Qgw/tp/xkpS1apLtHJaEZBRol9BJH5Py9IHBvD1aCO+19co nY3RH18otfKCeNXggDS895oqrXLIgayCyOff6jsqZRAVrPK2FH0uEFV/9gqn2zPsfxrd HXqyP7fiwCLUNnX1hOohBzhFY6JW7ZbjgczeSp2L98EtcilTCjwRM3+b3tolraWSlH0u +4SDK90ziIJesjHBDMXFgFHUjtzZioMhfUsjiLRsWDUms/U4A0ffUTPi35ArYdMnzc8H 79Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b="jnv/+KO6"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x19si974edr.378.2021.01.19.12.42.25; Tue, 19 Jan 2021 12:42:49 -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; dkim=pass header.i=@cloudflare.com header.s=google header.b="jnv/+KO6"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728231AbhASUlt (ORCPT + 99 others); Tue, 19 Jan 2021 15:41:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727729AbhASUlX (ORCPT ); Tue, 19 Jan 2021 15:41:23 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A954C061574 for ; Tue, 19 Jan 2021 12:40:33 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id c128so939785wme.2 for ; Tue, 19 Jan 2021 12:40:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Hqz5KkIUWAsMMr4Nkw2DHVorD8Rmr14UkHNWJhlYZr4=; b=jnv/+KO6i5GVy+raRH2CktGNmAyPW0kmZGHyjPRMIyNRYpsdPac9XA9MP5fazurmcq uCqt9zVEVQis/S9aVBLK7nY7cIsaz/HC6J+AP7AdKjkftzSD5cygQfazN6CZpkcl2NtD HYatepnZHhxbcuEELJSbkHVlDUDcnxBpnEIQk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Hqz5KkIUWAsMMr4Nkw2DHVorD8Rmr14UkHNWJhlYZr4=; b=TSkxJqluozQdIrA0S3O1KAN6ix8LT6s3iMMQgSz0By6AJZ9HtGWpyTua053KA07h3R T6TMhaN1DOlEXCywVGj60Qhen5Rq7eOfeTOcocdhVXN3WM4DKZ30Et89NGMXdJEg/OUN SM3Sm/zOT6RMylYSHVqQA2bt1D8VwkhvoCQr8uhgRWwWspQC+goaXQhzqLw9hvt4ZlhR wCKcDZXBmtNvwYkqq3qIzKnELIJJZiV8HX0Refr7DQA8STIxxO568VdGZnGWMVyqHqop wxHsoW9+k7CnynXHsdIDXrPwUsduwMNs9lGMDlJgtIV4IXmXmMuLRJNsczpPOkVoApbT eXtw== X-Gm-Message-State: AOAM530HwNcbKiVzduB0ntDXUw/KqlrEc/zPepIfD7saQUkgpXWiiS0E 2oG4RVUyYKMD/Gax3LcQnf1EuQ== X-Received: by 2002:a7b:cbd5:: with SMTP id n21mr1280568wmi.5.1611088832105; Tue, 19 Jan 2021 12:40:32 -0800 (PST) Received: from localhost.localdomain (29.177.200.146.dyn.plus.net. [146.200.177.29]) by smtp.gmail.com with ESMTPSA id x128sm6642847wmb.29.2021.01.19.12.40.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 12:40:31 -0800 (PST) From: Ignat Korchagin To: agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com, dm-crypt@saout.de, linux-kernel@vger.kernel.org Cc: Ignat Korchagin , kernel-team@cloudflare.com, pavel@denx.de, stable@vger.kernel.org Subject: [PATCH] dm crypt: fix invalid copy paste in crypt_alloc_req_aead Date: Tue, 19 Jan 2021 20:40:15 +0000 Message-Id: <20210119204015.49516-1-ignat@cloudflare.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In commit d68b295 ("dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq") I wrongly copy pasted crypto request allocation code from crypt_alloc_req_skcipher to crypt_alloc_req_aead. It is OK from runtime perspective as both simple encryption request pointer and AEAD request pointer are part of a union, but may confuse code reviewers. Fixes: d68b295 ("dm crypt: use GFP_ATOMIC when allocating crypto requests from softirq") Cc: stable@vger.kernel.org # v5.9+ Reported-by: Pavel Machek Signed-off-by: Ignat Korchagin --- drivers/md/dm-crypt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 8c874710f0bc..5a55617a08e6 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1481,9 +1481,9 @@ static int crypt_alloc_req_skcipher(struct crypt_config *cc, static int crypt_alloc_req_aead(struct crypt_config *cc, struct convert_context *ctx) { - if (!ctx->r.req) { - ctx->r.req = mempool_alloc(&cc->req_pool, in_interrupt() ? GFP_ATOMIC : GFP_NOIO); - if (!ctx->r.req) + if (!ctx->r.req_aead) { + ctx->r.req_aead = mempool_alloc(&cc->req_pool, in_interrupt() ? GFP_ATOMIC : GFP_NOIO); + if (!ctx->r.req_aead) return -ENOMEM; } -- 2.20.1