Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2094421ybl; Thu, 30 Jan 2020 11:15:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxKxnLdMf5KDFeZnAzfiXYZawVpG8/AT7eSa0OGxrcbdROyIkGFY086c0oQTKUCM+n4U5bE X-Received: by 2002:a54:4895:: with SMTP id r21mr4012931oic.107.1580411723713; Thu, 30 Jan 2020 11:15:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411723; cv=none; d=google.com; s=arc-20160816; b=DXn8I+QizIUahN3pPt/t2LzxDO2Sc2lO1KrzcEqwavQYaXR9grjGzchf4qFEiLYZka 1LuwNY+ZTJ+t8xeiHWxpbV8s+wZdeEJsubo66LEuq1YqcJsHxByx18Vee7WZLSlslVTR qOmse5eR2I2xlCHEY2l5D4b4oYN8fW5ilsPjqqbn6XbOYvGmwLR4SLS0njITdETNmBiq p4nxmdYdmkIRW+kJFn35+Mz696VKS6lT7NBxIHSyFf2ajTXzmH75Bordz5658tz8g1r/ xDPH7uohnDVAVXFL4KQ4pRRsoj513J6mz3Hlsov/xFkSLGvQyi5AxKGIF2P4OEuNkdv0 5mCA== 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=Ip1/Vg2+xlxqLSY+VuErlBMNIHZADc0htOQE4t8+Lkelh3sSNbs1EgB5d1HNuAEDK9 xcxaMC4SNawCt+ob+Q/h31qxUlztTIB6FCjACRphrmJWxlBSovJAsqoIv5R3f6PDEbxQ Wx8R4e5g3RAejgIIWeoLxbAra3FibK9IKpp8+fAxT7w/0JPfs1JUTcr2hwm7beWKzpkV X3TQWLuCu3I9e1CJM5mqVdXSolmwr+MxtRSjpOAnnQghASdG6YZZXzLtBfqrBOp3OKuU 3Tuh6mQ+PqZjY0cXwbQcAM7pcX7iKeO6TUgH5LdooOZwXauNXuwRg5T5/oDv2P0ydIXa M2cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ogAMtGSY; 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 w13si3298014oti.291.2020.01.30.11.15.11; Thu, 30 Jan 2020 11:15:23 -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=ogAMtGSY; 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 S1730221AbgA3Sll (ORCPT + 99 others); Thu, 30 Jan 2020 13:41:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:49600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730200AbgA3Slg (ORCPT ); Thu, 30 Jan 2020 13:41:36 -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 32A2F205F4; Thu, 30 Jan 2020 18:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409695; bh=O6+CZwV5/GKO30XluKSVwYLUjTq2JGzDCBB2SFqBBys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogAMtGSYZxHEYNzJuoXkKBlKJDcRKnQc5aQnflORUgYTHURTsc4zypNa21zRbmzCQ meVLxwuAsueFl5zb3NnbDr8nw7qX8hqFnAXgUPL8neNO2vTaluTQctFDFcMu5sVVr9 4Gti8zPVrPXcpCAvc6rw7KCKZFISVc4I1RTcQuBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Herbert Xu Subject: [PATCH 5.5 53/56] crypto: pcrypt - Fix user-after-free on module unload Date: Thu, 30 Jan 2020 19:39:10 +0100 Message-Id: <20200130183618.357157371@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183608.849023566@linuxfoundation.org> References: <20200130183608.849023566@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);