Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3638338pxb; Mon, 24 Jan 2022 14:07:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDey94MwvBvjmcCr3IjCrniRoHdkwmeHbHSzz2uk4HPA7VFkMt6jqgFzLWN8wijEc9EDLV X-Received: by 2002:a63:41c6:: with SMTP id o189mr4974285pga.613.1643062074323; Mon, 24 Jan 2022 14:07:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062074; cv=none; d=google.com; s=arc-20160816; b=zhC66OxFdjm2t+kHx1cQJt7TZ6At1/M7pkaFOZtgLFM6yxd4GLxWqg9HUJk35Z9MMW AhVuE2Jozdu0yQO4UyoTSHSp21GdOfYWzZzbPmNrSSnGhZvOnmD2VcusGszl5dklQQHt i3aCZRdniZ4xCmQZGxYlLyo2QBXiDEhDxcKz85Jd5tY0LTSD8l67+HGwJkc65658dBOs olP37WPH8ni/mXmXE8RBi1XSoPTwDSzmPmM50wjvBh+L+eYiuymT2HrZIRQzkFjelnNX 4dsDzlcrBdTQhFs8CM0W0scEE9T1IKbXGUhDv7RBZTflORvS7HfK008ZRjhzp/MEZMIl gw6g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v/suFVwsys7str5s3JOZK4c2RTOIi3d1U34yE7+yOHs=; b=M4JzDX3ZWtNVmptYoYeUc6zIBNvC2qLfcs6rLJUp540vbBQkhZ8o1ivNBD0k4uh3Aa fjKwIaPOwr6IzgETTE5GQtdFxIcticSjeAPQAdotmBH3aLZio/19ffgWhK4s6v9mKfrV BTYYC8M4JuHU4sZc83IoZek83T6jDkh2wn4wK4Dyz3YiuDh41395ZRa32NdCihdR3WaL po1UBgUDpW4LalacWOhcEGPyfWMkZ8jGW5hboRm3UexS+5dpU0fAd1VkOO0VofcF7oEM lOaHdHJjimwkyP8o4E4bhsTQQKLas50DYDtnrs8vTd3CH1DVgWeA6aO4Q3w2u2dqMpGk SmbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M3d0zvkQ; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g193si711823pgc.397.2022.01.24.14.07.37; Mon, 24 Jan 2022 14:07:54 -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=@linuxfoundation.org header.s=korg header.b=M3d0zvkQ; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1576787AbiAXV4Y (ORCPT + 99 others); Mon, 24 Jan 2022 16:56:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1450887AbiAXVVn (ORCPT ); Mon, 24 Jan 2022 16:21:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56EC0C0604E4; Mon, 24 Jan 2022 12:16:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EB845611CD; Mon, 24 Jan 2022 20:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D425BC340E5; Mon, 24 Jan 2022 20:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055395; bh=QA8+oOIsCW4SEIRGEnJ6v+finhlrCS8bNEytK881OKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3d0zvkQjcGslb1qbw+C8LbdHJPk8khVuCa8PFClLorIAbxwtSALlsnD8cQnwWZaE 06kI9dO7F1zD5A0UIZ7H+ZCoKCIrI1QgoTVPHSW3IAhh9X80cIT+uMD3Z4T87XPP8g GFGXGZGYgWGLSEcMHmKhPMZ+csCLYNXKJcWYVIT4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfgang Ocker , Tudor Ambarus , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 137/846] crypto: atmel-aes - Reestablish the correct tfm context at dequeue Date: Mon, 24 Jan 2022 19:34:14 +0100 Message-Id: <20220124184105.717837467@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tudor Ambarus [ Upstream commit 6d48de655917a9d782953eba65de4e3db593ddf0 ] In case there were more requests from different tfms in the crypto queue, only the context of the last initialized tfm was considered. Fixes: ec2088b66f7a ("crypto: atmel-aes - Allocate aes dev at tfm init time") Reported-by: Wolfgang Ocker Signed-off-by: Tudor Ambarus Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/atmel-aes.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 9391ccc03382d..fe05584031914 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c @@ -960,6 +960,7 @@ static int atmel_aes_handle_queue(struct atmel_aes_dev *dd, ctx = crypto_tfm_ctx(areq->tfm); dd->areq = areq; + dd->ctx = ctx; start_async = (areq != new_areq); dd->is_async = start_async; @@ -1274,7 +1275,6 @@ static int atmel_aes_init_tfm(struct crypto_skcipher *tfm) crypto_skcipher_set_reqsize(tfm, sizeof(struct atmel_aes_reqctx)); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_start; return 0; @@ -1291,7 +1291,6 @@ static int atmel_aes_ctr_init_tfm(struct crypto_skcipher *tfm) crypto_skcipher_set_reqsize(tfm, sizeof(struct atmel_aes_reqctx)); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_ctr_start; return 0; @@ -1783,7 +1782,6 @@ static int atmel_aes_gcm_init(struct crypto_aead *tfm) crypto_aead_set_reqsize(tfm, sizeof(struct atmel_aes_reqctx)); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_gcm_start; return 0; @@ -1927,7 +1925,6 @@ static int atmel_aes_xts_init_tfm(struct crypto_skcipher *tfm) crypto_skcipher_set_reqsize(tfm, sizeof(struct atmel_aes_reqctx) + crypto_skcipher_reqsize(ctx->fallback_tfm)); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_xts_start; return 0; @@ -2154,7 +2151,6 @@ static int atmel_aes_authenc_init_tfm(struct crypto_aead *tfm, crypto_aead_set_reqsize(tfm, (sizeof(struct atmel_aes_authenc_reqctx) + auth_reqsize)); ctx->base.dd = dd; - ctx->base.dd->ctx = &ctx->base; ctx->base.start = atmel_aes_authenc_start; return 0; -- 2.34.1