Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3624083pxb; Mon, 24 Jan 2022 13:46:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/3zEohW5i15d3kcNj+dIGR0G8uQF47JnII/EDOAc3SK41/O8wOYintheO3Ek/RKcXF9Xt X-Received: by 2002:aa7:9217:0:b0:4c2:5a97:31e9 with SMTP id 23-20020aa79217000000b004c25a9731e9mr15601788pfo.16.1643060817812; Mon, 24 Jan 2022 13:46:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060817; cv=none; d=google.com; s=arc-20160816; b=HH2X2dWdrB/vosQ1wlMIksAu+Duca1uDpVQYNoS1f0uaMSDl2zTy5IXDMhveQ2Kysm cMN6lj5u/hxvOoHKnLq1llRH7mKIdoKLoKPGVDVGSvBulkml0W7mjer8RhdKkiiq5fVI pzFILjt+K4NsR+jfQSQr01yZCMh2/OAtMsEtWcNlrwCwJmeMmMPdSZo8ixaHMiYVcXtN n0lyGwOWjbVzZvGryPxA9/LARHbSEeeQfeqbM107C26oZXuxTtItR40kVdS7gcqNhczO efv1qLOSJMwFtPsX2tt+gsAyJXqQ3pIJ2LqJI7/LjyKDJtC11pv7z/TmSs17sTK8ONIL KTwg== 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=OwSRQaA4zBxgXPdhi7hkxidIfpArSEbEShGz9RqH1jWBV/HE/9gPPOwtI+wbt1f4QG +txUfbZ7Qg53j6u6Xpc+sK2FgNNC16YtAYxKOm8k/iAYGKCk+Y5nPP16geniY5K/CDXm MsmezEzUAz0X6Ws59M6ldIE+VlxcXKJvHlVJ1g5kxgxejD8D/SUxc448iSgYSE1mFYMo bEpiSH0yzZF1bzxo8T4/WByx7tmhNmxaiAgp7MkxQ2ymuun87FyD6Q8O0IUWtHvicwZl Jybkt71s+SgSi+7M8Gi7Xend3Na4ew4G8OsOGhlDjhD5uhUiuxEJFvbjXlzKvS/mW23a yEYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RD1D1Jeg; 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 q3si444606pjf.139.2022.01.24.13.46.43; Mon, 24 Jan 2022 13:46:57 -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=RD1D1Jeg; 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 S1378225AbiAXV23 (ORCPT + 99 others); Mon, 24 Jan 2022 16:28:29 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55514 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444715AbiAXVBW (ORCPT ); Mon, 24 Jan 2022 16:01:22 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id 79F1FB80FA3; Mon, 24 Jan 2022 21:01:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F8E5C340E5; Mon, 24 Jan 2022 21:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058079; bh=QA8+oOIsCW4SEIRGEnJ6v+finhlrCS8bNEytK881OKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RD1D1JegVhp8qeCr0zIYTs60MzjsvDZj8piRkzbndsQHT1WHRdKFMI+j7iaDhrJnd jg7XkQL8BPDAdiShNudVgbgVb0J1lZxcjpNEm4KEljMyVd/+GLBeQr5JoeHZSAZ0tm ADuU+s769atr/pFVSloJN3XCL/9DfT5xzDhdcjlg= 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.16 0157/1039] crypto: atmel-aes - Reestablish the correct tfm context at dequeue Date: Mon, 24 Jan 2022 19:32:26 +0100 Message-Id: <20220124184130.453484468@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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