Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3696118pxb; Mon, 24 Jan 2022 15:37:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdBq/eL9OdjSLXoRB+4xhJLKA3i5qaejkvDB5aNkefAq52LVMSdoxPnYQDCneYSErE48Jk X-Received: by 2002:a17:90a:2bc8:: with SMTP id n8mr635904pje.224.1643067444886; Mon, 24 Jan 2022 15:37:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067444; cv=none; d=google.com; s=arc-20160816; b=wzU5dzwVZQ75wZVLizbBkC17npjz7CFqnHpNGce3ylLsqLKLW+XCilCmM3EXqexc3S NkptmasowPmWIrk0hRknBdh7qIO/Gr289EFlfrXt2X0qZg4jNlwEzC2PsWGJjplHpuEJ fNkt7uAf5uDRj8HXK1fQXZAs2WyBbyL0XNZDuUbh4Uqlzi7b7a5PNSDCfsy16r9yDZK+ i92Z1Zf2huy1LdMWzOWH9BSWkPaEDZY2VruU/HB98x3kEEYn6A8AoWIgn8im32Hoeseu cCki7MaJVQkUHwOZydoPLo25s4RihKLGjaool2Y8OS6gTNphrfaB7k8HIBUymjAmGzia aNDQ== 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=2l87y+3UOA4EwK/OOpMZDI85ydOxAXdd5p6xB6Fv4/U=; b=e2wKiuWo3q+gXCyKbaBE8hlpd5ZLzG7n9eLB3NxLQ/PV/y8pdfROA+I8o3Ps+A64IX 2T6hU/TjA3oyx3wPAAS7k7YpaokvercjeKC5fMR/Hxc51NCBPOUQtlRczmxyufURDYjz K+wR8ciQGPL+VYW4+UutRi42TnlypvwrGglrhqfygr/riA7iI+sPnxRhh16yNRAomYwJ goaAU5FUmR7CUYWiaajjNDQZdqdn5mM0J1T1ryYLPk5hQUllBLV7XtRR18mE4jLp3QVP qKOj+1Na0S2MeoRoAdZgEnaq6goBgqgHCfFQOVQ+tnshn4t8dTh5mKFdjaWbMGma5SAA 7vQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=StZNNdUg; 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 h67si14851635pgc.802.2022.01.24.15.37.12; Mon, 24 Jan 2022 15:37:24 -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=StZNNdUg; 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 S1851112AbiAXXb5 (ORCPT + 99 others); Mon, 24 Jan 2022 18:31:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836498AbiAXWjh (ORCPT ); Mon, 24 Jan 2022 17:39:37 -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 4448BC054879; Mon, 24 Jan 2022 13:02:17 -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 D81E860E8D; Mon, 24 Jan 2022 21:02:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1C93C340E5; Mon, 24 Jan 2022 21:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058136; bh=KSy15URbnYdQ2MDCfeKbuVXx50REXtYPVx5KWVcdnkE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=StZNNdUgOtJ6Xnr/PZy9tjy8qpYIVwvP9aBuK2s18Pr+aDOMlIhFMFL2C2PgEkJ1i r/NzgOZYcqH1BlEjsUi7t1R2erYD9wH0AB7JG0lIENvnB54bOOYo0xvDnBNKWwaf2i +qbXMxI5JD1EvVdVnvBWuIXKoSkNo02WLF/GOmKo= 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 5.16 0159/1039] crypto: qce - fix uaf on qce_aead_register_one Date: Mon, 24 Jan 2022 19:32:28 +0100 Message-Id: <20220124184130.541004389@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: Chengfeng Ye [ Upstream commit 4a9dbd021970ffe1b92521328377b699acba7c52 ] Pointer alg points to sub field of tmpl, it is dereferenced after tmpl is freed. Fix this by accessing alg before free tmpl. Fixes: 9363efb4 ("crypto: qce - Add support for AEAD algorithms") Signed-off-by: Chengfeng Ye Acked-by: Thara Gopinath Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qce/aead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qce/aead.c b/drivers/crypto/qce/aead.c index 290e2446a2f35..97a530171f07a 100644 --- a/drivers/crypto/qce/aead.c +++ b/drivers/crypto/qce/aead.c @@ -802,8 +802,8 @@ static int qce_aead_register_one(const struct qce_aead_def *def, struct qce_devi ret = crypto_register_aead(alg); if (ret) { - kfree(tmpl); dev_err(qce->dev, "%s registration failed\n", alg->base.cra_name); + kfree(tmpl); return ret; } -- 2.34.1