From patchwork Fri Oct 23 23:27:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 11854655 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29C7F6A2 for ; Fri, 23 Oct 2020 23:28:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7747421D43 for ; Fri, 23 Oct 2020 23:28:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="gXYhXxRK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7747421D43 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5B2D36B005C; Fri, 23 Oct 2020 19:28:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 564FA6B0062; Fri, 23 Oct 2020 19:28:22 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A3126B0068; Fri, 23 Oct 2020 19:28:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id 1D7AC6B005C for ; Fri, 23 Oct 2020 19:28:22 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BDE258249980 for ; Fri, 23 Oct 2020 23:28:21 +0000 (UTC) X-FDA: 77404781202.20.hole50_16140e02725d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 9FB62180C07A3 for ; Fri, 23 Oct 2020 23:28:21 +0000 (UTC) X-Spam-Summary: 1,0,0,7c8baa97bd7f3e63,d41d8cd98f00b204,ebiggers@kernel.org,,RULES_HIT:41:355:379:541:800:960:965:966:968:973:988:989:1260:1311:1314:1345:1437:1515:1535:1544:1711:1730:1747:1777:1792:1801:2194:2196:2199:2200:2393:2559:2562:2693:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3870:3872:3873:3874:4250:4321:4385:4390:4395:4605:5007:6119:6261:6653:7576:7903:9592:10004:11026:11232:11473:11657:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:12986:13161:13229:13894:14096:14181:14394:14721:21080:21433:21444:21451:21627:21740:30054,0,RBL:198.145.29.99:@kernel.org:.lbl8.mailshell.net-62.2.0.100 64.100.201.201;04yfoqe8qoyzjxzt49qa5pti8cym3yp98mhgwxf9saiede4iiatkzd3ce1p1j17.tsbpo1n5nif1zekyzxzpsp8gmiboox1536z5zpdumz35bjedihkqiq8k7tr64xk.k-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: hole50_16140e02725d X-Filterd-Recvd-Size: 5605 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Fri, 23 Oct 2020 23:28:21 +0000 (UTC) Received: from ebiggers-linuxstation.mtv.corp.google.com (unknown [104.132.1.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EB5942168B; Fri, 23 Oct 2020 23:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603495700; bh=T3uwsNs7A0BKQjRH8LF/cDQDMTP5GDmkrV+Ttr91asc=; h=From:To:Cc:Subject:Date:From; b=gXYhXxRK6yFnYIPUbfAC87ScYdkfJ5ggr1ju9aVkscpHMCO62FxcLVx1ntGeJ+oXf +R7AUyfkzBdFaDzAKilgdnehbq7dcikjPir5sfsh0TQURGTW8xFABPbvmZBgnsi0ow A0XSlKy4VdKS1zaUs1yKKAIcNsEcyzf2KE+n4PcU= From: Eric Biggers To: Linus Torvalds , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , Joe Perches Subject: [PATCH] mm: remove kzfree() compatibility definition Date: Fri, 23 Oct 2020 16:27:16 -0700 Message-Id: <20201023232716.417926-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Eric Biggers Commit 453431a54934 ("mm, treewide: rename kzfree() to kfree_sensitive()") renamed kzfree() to kfree_sensitive(), but it left a compatibility definition of kzfree() to avoid being too disruptive. Since then a few more instances of kzfree() have slipped in. Just get rid of them and remove the compatibility definition once and for all. Signed-off-by: Eric Biggers --- Linus, are you interested in applying this around the time of v5.10-rc1? There's not really any reason to keep this around, and people will otherwise keep introducing new uses. drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 2 +- drivers/staging/rtl8192e/rtllib_crypt_wep.c | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 2 +- include/linux/slab.h | 2 -- net/tipc/crypto.c | 4 ++-- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index 8c2ff37b2d3a..238387d6221b 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -100,7 +100,7 @@ static void rtllib_tkip_deinit(void *priv) crypto_free_shash(_priv->tx_tfm_michael); crypto_free_shash(_priv->rx_tfm_michael); } - kzfree(priv); + kfree_sensitive(priv); } diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c index 7cdd17f907fa..7790271a6a40 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c @@ -49,7 +49,7 @@ static void *prism2_wep_init(int keyidx) static void prism2_wep_deinit(void *priv) { - kzfree(priv); + kfree_sensitive(priv); } /* Perform WEP encryption on given skb that has at least 4 bytes of headroom diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index 4b415cc76715..e8fa1d385f24 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -107,7 +107,7 @@ static void ieee80211_tkip_deinit(void *priv) crypto_free_shash(_priv->tx_tfm_michael); crypto_free_shash(_priv->rx_tfm_michael); } - kzfree(priv); + kfree_sensitive(priv); } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 1c56e2d03aae..a41b6510481b 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -54,7 +54,7 @@ static void *prism2_wep_init(int keyidx) static void prism2_wep_deinit(void *priv) { - kzfree(priv); + kfree_sensitive(priv); } /* Perform WEP encryption on given skb that has at least 4 bytes of headroom diff --git a/include/linux/slab.h b/include/linux/slab.h index 9e155cc83b8a..dd6897f62010 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -187,8 +187,6 @@ void kfree_sensitive(const void *); size_t __ksize(const void *); size_t ksize(const void *); -#define kzfree(x) kfree_sensitive(x) /* For backward compatibility */ - #ifdef CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR void __check_heap_object(const void *ptr, unsigned long n, struct page *page, bool to_user); diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c index 40c44101fe8e..740ab9ae41a6 100644 --- a/net/tipc/crypto.c +++ b/net/tipc/crypto.c @@ -418,7 +418,7 @@ static void tipc_aead_free(struct rcu_head *rp) kfree(head); } free_percpu(aead->tfm_entry); - kzfree(aead->key); + kfree_sensitive(aead->key); kfree(aead); } @@ -2452,7 +2452,7 @@ static void tipc_crypto_work_tx(struct work_struct *work) tipc_crypto_key_init(tx, skey, PER_NODE_KEY, false); if (likely(rc > 0)) rc = tipc_crypto_key_distr(tx, rc, NULL); - kzfree(skey); + kfree_sensitive(skey); } if (unlikely(rc))