hc
2023-11-22 f743a7adbd6e230d66a6206fa115b59fec2d88eb
kernel/drivers/connector/cn_proc.c
....@@ -32,6 +32,7 @@
3232 #include <linux/pid_namespace.h>
3333
3434 #include <linux/cn_proc.h>
35
+#include <linux/locallock.h>
3536
3637 /*
3738 * Size of a cn_msg followed by a proc_event structure. Since the
....@@ -54,10 +55,11 @@
5455
5556 /* proc_event_counts is used as the sequence number of the netlink message */
5657 static DEFINE_PER_CPU(__u32, proc_event_counts) = { 0 };
58
+static DEFINE_LOCAL_IRQ_LOCK(send_msg_lock);
5759
5860 static inline void send_msg(struct cn_msg *msg)
5961 {
60
- preempt_disable();
62
+ local_lock(send_msg_lock);
6163
6264 msg->seq = __this_cpu_inc_return(proc_event_counts) - 1;
6365 ((struct proc_event *)msg->data)->cpu = smp_processor_id();
....@@ -70,7 +72,7 @@
7072 */
7173 cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_NOWAIT);
7274
73
- preempt_enable();
75
+ local_unlock(send_msg_lock);
7476 }
7577
7678 void proc_fork_connector(struct task_struct *task)