lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241120064716.3361211-5-ranxiaokai627@163.com>
Date: Wed, 20 Nov 2024 06:47:16 +0000
From: Ran Xiaokai <ranxiaokai627@....com>
To: juri.lelli@...hat.com,
	vincent.guittot@...aro.org,
	mingo@...hat.com,
	peterz@...radead.org,
	pshelar@....org,
	davem@...emloft.net
Cc: linux-kernel@...r.kernel.org,
	ran.xiaokai@....com.cn,
	linux-perf-users@...r.kernel.org,
	netdev@...r.kernel.org,
	dev@...nvswitch.org
Subject: [PATCH 4/4] net: sysfs: convert call_rcu() to kvfree_rcu()

From: Ran Xiaokai <ran.xiaokai@....com.cn>

The rcu callback rps_dev_flow_table_release() simply calls vfree().
It's better to directly call kvfree_rcu().

Signed-off-by: Ran Xiaokai <ran.xiaokai@....com.cn>
---
 net/core/net-sysfs.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 2d9afc6e2161..8ba2251af077 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -947,13 +947,6 @@ static ssize_t show_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
 	return sysfs_emit(buf, "%lu\n", val);
 }
 
-static void rps_dev_flow_table_release(struct rcu_head *rcu)
-{
-	struct rps_dev_flow_table *table = container_of(rcu,
-	    struct rps_dev_flow_table, rcu);
-	vfree(table);
-}
-
 static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
 					    const char *buf, size_t len)
 {
@@ -1008,7 +1001,7 @@ static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
 	spin_unlock(&rps_dev_flow_lock);
 
 	if (old_table)
-		call_rcu(&old_table->rcu, rps_dev_flow_table_release);
+		kvfree_rcu(old_table, rcu);
 
 	return len;
 }
@@ -1046,7 +1039,7 @@ static void rx_queue_release(struct kobject *kobj)
 	flow_table = rcu_dereference_protected(queue->rps_flow_table, 1);
 	if (flow_table) {
 		RCU_INIT_POINTER(queue->rps_flow_table, NULL);
-		call_rcu(&flow_table->rcu, rps_dev_flow_table_release);
+		kvfree_rcu(flow_table, rcu);
 	}
 #endif
 
-- 
2.17.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ