Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2098695ybl; Thu, 30 Jan 2020 11:19:49 -0800 (PST) X-Google-Smtp-Source: APXvYqy5LJdTQ4l8CVu4G67A8qssLGSw2PLp2spAuM+xZS56qiMPKDTQuI+PnfbAiLeRqEjwGT8M X-Received: by 2002:a05:6808:9a4:: with SMTP id e4mr3969801oig.127.1580411989357; Thu, 30 Jan 2020 11:19:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411989; cv=none; d=google.com; s=arc-20160816; b=fAyL1dE97BYF41cxdnUDXGO3rAxWOu2/0MarJSSm2RiYLS61vGSay6S5EE4Jq94uaz R/YkeVM77KjXaNbfaoJKdwmYj452Is4wFkT/Xh5f2Pnk7LNg5sUhj1i/4ELo3klFSH0u oma8wa7wDIFE0eFLUq5ac4NxVaqNz8o4emWr/qf3hY+iT/yIAIV01bsNAn6sK87doosC T7/2zDmQITpHvbPOfAZaEM4Y/InjHURnfOppG9aeWyVSK3rBk4uPfLbdUOpnKRMh6wZW C/3Q9rJbsy3VTL6sepM9trUP0zdD1mvLP1rjpicqhU1KkuFTo2pSJlaKn9A4fsXOyUIs Lu4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vi8sf1whJOgYvWR/KKBJj5wI3KDRldp5jQt+ZKyKmIM=; b=s8RHwT62BNvDfDLPwfCLSCfM6SkQjM3kMDoLGXKSkfVMYlFa9h0L016UlcAYyZxOyk 7vWqOqfZigyU35keVM5K2a2vEWHYrAoA1AzSVZe3BXwSYQVDoImG/04c9QikLEHcFJUI +usSh2OrGjX3U5QgRiEmjmNv7Ass5dgS+2dA9QZoTEsbnWgL4mSaaGD3pv9xUBw0o8Dn jDiRPqH3+A/rCqEX980l7CCulJlAp/sJLCqm1q54rDT5KgBRKEteRZWnsgFn9MUk4vQy /VrzyyATm4NQFHH46+mBgnU2tfqiya14x4KzMka5D7qK/2fL6iok5jUsYRLcqaXyZ/1x LgoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pO7pRbgB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si3331444otp.139.2020.01.30.11.19.37; Thu, 30 Jan 2020 11:19:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pO7pRbgB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731187AbgA3SqW (ORCPT + 99 others); Thu, 30 Jan 2020 13:46:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:56158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731158AbgA3SqO (ORCPT ); Thu, 30 Jan 2020 13:46:14 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 24BB42083E; Thu, 30 Jan 2020 18:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409973; bh=O6+CZwV5/GKO30XluKSVwYLUjTq2JGzDCBB2SFqBBys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pO7pRbgBKvw9YdxKvtgLBuOV1yMFrPU5z7Kr7rN4zU3azYmJVxr/bM8gyK3aG8pV6 8NqiWfScaaUSzpZcM46k2PmkzNasqFIhz2LpEahZfMXjQjyI3zZmPSM7KT9LVYbUNn oFDtoyjWCSfHP1KHGIld6SJ2Y+RdnfOhGSsmz0bQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Herbert Xu Subject: [PATCH 5.4 107/110] crypto: pcrypt - Fix user-after-free on module unload Date: Thu, 30 Jan 2020 19:39:23 +0100 Message-Id: <20200130183626.075084354@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183613.810054545@linuxfoundation.org> References: <20200130183613.810054545@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Herbert Xu commit 07bfd9bdf568a38d9440c607b72342036011f727 upstream. On module unload of pcrypt we must unregister the crypto algorithms first and then tear down the padata structure. As otherwise the crypto algorithms are still alive and can be used while the padata structure is being freed. Fixes: 5068c7a883d1 ("crypto: pcrypt - Add pcrypt crypto...") Cc: Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- crypto/pcrypt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/crypto/pcrypt.c +++ b/crypto/pcrypt.c @@ -362,11 +362,12 @@ err: static void __exit pcrypt_exit(void) { + crypto_unregister_template(&pcrypt_tmpl); + pcrypt_fini_padata(pencrypt); pcrypt_fini_padata(pdecrypt); kset_unregister(pcrypt_kset); - crypto_unregister_template(&pcrypt_tmpl); } subsys_initcall(pcrypt_init);