Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3818731iob; Tue, 17 May 2022 07:52:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC8X56xEZ/zj4WRThACWL9h9rqeqwE46DgCrkaNein1u/uf5jHxcZHRvHLwo4HrwH0Ewkl X-Received: by 2002:a17:907:6284:b0:6e0:f895:15a with SMTP id nd4-20020a170907628400b006e0f895015amr20358380ejc.713.1652799122174; Tue, 17 May 2022 07:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652799122; cv=none; d=google.com; s=arc-20160816; b=oHhgjT9UlS2UVoKDS8gQpbJd791aMxg9fMt9rXM3qk92lgG/jrWhzbYj7wadHb00cV 0ZQDvn9Xx9vSEh0JpFf3zUThsWKa0NCi5Lu++b+vF4VKMsJVDogay+8oqM+BZ+rptpmh 6wQJ1nyxhHqscUIsAbZ8OFUWyjB3YK43aH5moHTh2fWwiDdn+MWH66m92B6JViADm0XA VGxkK/GRvVYAFpIOKPpu0FXKYwe8Gb72djUbPktEGj03KKjYKJxHB3EMdlGMsheWlLBL A0KyJuQcH7++bsDyagXhSM1LEhv7bbjSz9JCLMNwNKXLsM7HXpYB3qY396OkbLgZQ2+r xRYw== 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=wVhR+tLTgWRBv165klscGkwBvwtkGY4K+gXBpaEt39o=; b=fpacg9jyZBz4wly3lh+GOuxQLjdXx1Z4L44ijLY8hsKE/iPybyQmAMXnlkKr5sH252 lzTJgLF0h86bbLUBOFZYtxkhYlLSc3KeHuCP/oBk222GjPJ6DIUJ1Sszzt4QP7uXHCc6 y84JDiLcu0K8aD/3Ibf0iPTd0FYSJix3SBJ+FxL1DpKeYmjE4K7MFg7sYSdeock4J62I /y0n+dPYnMFVT32w8e9Ch67P1gSUnhT3LxiXvpoQJcxLMqIhbrxg+ZwyMB+qBSP6s9Jy 1ONhAm3BctdtljOcVv2UZnTrn37uiZwu5cMs3HD2LocRqeQMSeiIPgEKjnRGv+JauTKM 7wbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=AVNWGASS; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a170906548700b006f3b09a0436si2911616ejo.665.2022.05.17.07.51.24; Tue, 17 May 2022 07:52:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=AVNWGASS; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348926AbiEQObJ (ORCPT + 99 others); Tue, 17 May 2022 10:31:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348966AbiEQObE (ORCPT ); Tue, 17 May 2022 10:31:04 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6823817072 for ; Tue, 17 May 2022 07:31:02 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id f2so18014758wrc.0 for ; Tue, 17 May 2022 07:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wVhR+tLTgWRBv165klscGkwBvwtkGY4K+gXBpaEt39o=; b=AVNWGASSw6V5RUrPE0Xe922Dr1PoPah/DHCQjXENO9s0HFGB/eYpWl6axQWl/QnFZH uRmMiarJD/nw2TwKyvyACE+uNu/LtM636YM+bXBmDWbMz/LvizwmSvb0uhzKoKggSF9I RddWK4xmLBsCErMkW0NkfvF8unM5J4Sy7tB4XDdauDZT+qkVIm80Ijx7DdSpJQlMeNUQ 9MruKiM1t0I8MvBJdkw8JEuhdV4K7V79+VHa98U7QbGacXpl6JEqLz3ahlSfKlJq2FYV w4pzBlJMAMO9CapLPiqmyQnhrxlET8Is5fQXqESFEI2JcPHofkbd9BYb47Gp15j9BJBN XJ8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wVhR+tLTgWRBv165klscGkwBvwtkGY4K+gXBpaEt39o=; b=3fAO5RFWPnb1SOLfU9pn/KNv+A55WuEf6ynEpIwNImCcxT6qnwKl8+5K0ELR29l6Tp /pNkchyovbPHlADAXGLjbEn4E5UYKWDybh4SyIp5srKQnKzde2He/xDFux+7ZoFjYjrp PS6PdscuNYUt2B6ozMtwDuexA2Pv/QQTZUm36s5gKMzVlQDirsea/he/p47EDKgheqwk uEtxhNFP9XDCVLXuGgyg+GDQnaKPzZPrcnyX/c9kZa8Gs0p9OKHgoCt41cWLrQTqnRyQ 2DmgnBMryAhWTdQdn+hR7q1xwCzDHXC7XC1wHNpvbOxfPB7zXE9YgW42BGzLaoyzRjf+ OmQw== X-Gm-Message-State: AOAM532kJG/fwGzzll6Q562D3oKgubpH1g14mx/YqAcM+MqmJeU06YH+ iGkAKjFup5CGAkAQZbXPlq31ZpJlyCrKuQ== X-Received: by 2002:adf:ef8a:0:b0:20d:1028:3c36 with SMTP id d10-20020adfef8a000000b0020d10283c36mr6256611wro.481.1652797860454; Tue, 17 May 2022 07:31:00 -0700 (PDT) Received: from localhost ([2a00:79e0:9d:4:b946:2cd:4ff6:1fbf]) by smtp.gmail.com with ESMTPSA id m6-20020a05600c460600b003942a244f2fsm1956398wmo.8.2022.05.17.07.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 07:30:59 -0700 (PDT) From: Jann Horn To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev Cc: Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, Christian Borntraeger , Sven Schnelle , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] s390/crypto: fix scatterwalk_unmap() callers in AES-GCM Date: Tue, 17 May 2022 16:30:47 +0200 Message-Id: <20220517143047.3054498-1-jannh@google.com> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The argument of scatterwalk_unmap() is supposed to be the void* that was returned by the previous scatterwalk_map() call. The s390 AES-GCM implementation was instead passing the pointer to the struct scatter_walk. This doesn't actually break anything because scatterwalk_unmap() only uses its argument under CONFIG_HIGHMEM and ARCH_HAS_FLUSH_ON_KUNMAP. Note that I have not tested this patch in any way, not even compile-tested it. Fixes: bf7fa038707c ("s390/crypto: add s390 platform specific aes gcm suppo= rt.") Signed-off-by: Jann Horn --- IDK which tree this has to go through - s390 or crypto? maybe s390 is better, since they can actually test it? arch/s390/crypto/aes_s390.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index 54c7536f2482..1023e9d43d44 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c @@ -701,7 +701,7 @@ static inline void _gcm_sg_unmap_and_advance(struct gcm= _sg_walk *gw, unsigned int nbytes) { gw->walk_bytes_remain -=3D nbytes; - scatterwalk_unmap(&gw->walk); + scatterwalk_unmap(gw->walk_ptr); scatterwalk_advance(&gw->walk, nbytes); scatterwalk_done(&gw->walk, 0, gw->walk_bytes_remain); gw->walk_ptr =3D NULL; @@ -776,7 +776,7 @@ static int gcm_out_walk_go(struct gcm_sg_walk *gw, unsi= gned int minbytesneeded) goto out; } =20 - scatterwalk_unmap(&gw->walk); + scatterwalk_unmap(gw->walk_ptr); gw->walk_ptr =3D NULL; =20 gw->ptr =3D gw->buf; base-commit: 42226c989789d8da4af1de0c31070c96726d990c --=20 2.36.0.550.gb090851708-goog