Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3574436pxb; Mon, 24 Jan 2022 12:34:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHD7z6dJfZOIILfAlfnV5yyU75kWkHG6tuVqdusckke+SGhsDK+mmLDU5FZqPrftytidf2 X-Received: by 2002:a63:7d0e:: with SMTP id y14mr12957198pgc.356.1643056459553; Mon, 24 Jan 2022 12:34:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056459; cv=none; d=google.com; s=arc-20160816; b=sk4HJZts7QA4rm3tYfpqwCLr8HooLVz6kfeOvRiOwJaRYoO9nRiJjDW2vvfyFHKEsV wAQlzjORm7DJd2XargGLalecZPkKD2FX5sHiyh9xs8hJi0fq8eG06UYaZZ/gjQx8sqs3 xJswiQ60YRynXj29xDfHBwNm0+ofQgBikt/ghxjGUPn+fgZ4fLDRhoNsp5Om6FZRyRPj LL/+MHriO9w9FZX6K/989DwyG8+Bl77WsEaQ52ZtAQi17bvc+D0y9jC61Oq50JL8yQME dnsUwYdcn+//1pZuyl4UsOn+/d2eD9VhEiFsrD1Jc4dEAWSmGXRX2Y/ImR6lNB3D9S+F CO8A== 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=PMnXKgMGMcoJ9+CFMLQi4397KsjmFBrpw0ULlapWbxM=; b=zrQQVgcJv01cYWKOMjSBJc3X90Uy5adrMaG7xZ2sBhsGxph+ZcAzzNdp+R5FemT/RU ViTlvG7JKK2pRGDSmBGqnwXsWma0xm9fjtYaJNcr3julBdSwurf2Rfc31BKl/KzyejLm l6OKogQv8d61SIo9rIbqYltgDnSesoQilTuUNuQa2emUa8IrWYIQFwAVyDgtZ3v6R7XN KzP2y1DF0rOXWqFctdmaR66f8rev2mQV5F0sCgtEl5bVeV1/G/GyaEhBsQVbsbaTp1TV iaF84pG4Bt8FOTMxbFEWfmS7uBtbEVVxTJq1AWSYemD87EEu8qJAIZl3Ff8rS/f4K8PL Fs6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tvp2kzAw; 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 d4si13248703plr.158.2022.01.24.12.33.57; Mon, 24 Jan 2022 12:34:19 -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=Tvp2kzAw; 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 S1350685AbiAXTmx (ORCPT + 99 others); Mon, 24 Jan 2022 14:42:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353006AbiAXTbq (ORCPT ); Mon, 24 Jan 2022 14:31:46 -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 BAE94C0604CC; Mon, 24 Jan 2022 11:14:53 -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 5A58360B86; Mon, 24 Jan 2022 19:14:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E0C3C340E5; Mon, 24 Jan 2022 19:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051692; bh=2GBRf5isI7WxVEFzBNAez1QtihJLzttbdylD85HipyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tvp2kzAwL+AStvF+Bz2CyJFxHGPmFQJ4eMwL8B7BFfANagOBGNh9MWBKa7zo37eSZ Kkxk9ifQWrBBJE+zvsUbhRTklJ1AkaJHRKist6ph9/4SG1ok7ZvH0tMuEftnqBRh/R OG6BIjzcYyRkoq5qnq2/W2vG9EU3KUJYWioOw+mk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengfeng Ye , Thara Gopinath , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 056/239] crypto: qce - fix uaf on qce_ahash_register_one Date: Mon, 24 Jan 2022 19:41:34 +0100 Message-Id: <20220124183944.913708574@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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: Chengfeng Ye [ Upstream commit b4cb4d31631912842eb7dce02b4350cbb7562d5e ] Pointer base points to sub field of tmpl, it is dereferenced after tmpl is freed. Fix this by accessing base before free tmpl. Fixes: ec8f5d8f ("crypto: qce - Qualcomm crypto engine driver") Signed-off-by: Chengfeng Ye Acked-by: Thara Gopinath Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qce/sha.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qce/sha.c b/drivers/crypto/qce/sha.c index d8a5db11b7ea1..bffd4d15145d9 100644 --- a/drivers/crypto/qce/sha.c +++ b/drivers/crypto/qce/sha.c @@ -521,8 +521,8 @@ static int qce_ahash_register_one(const struct qce_ahash_def *def, ret = crypto_register_ahash(alg); if (ret) { - kfree(tmpl); dev_err(qce->dev, "%s registration failed\n", base->cra_name); + kfree(tmpl); return ret; } -- 2.34.1