connector: Fix proc_event_num_listeners count not cleared
authorwangkeqi <wangkeqiwang@didiglobal.com>
Sat, 23 Dec 2023 06:50:32 +0000 (14:50 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Jan 2024 10:51:47 +0000 (11:51 +0100)
commit1e6b9bc8cc36474c8cefac57f2503b2a0170ce61
treeeeb57361a68886284b64aacf89de6662dcd56ffc
parent6a186b28c4fcfbcd9d50f26224457c8fe1dc47d0
connector: Fix proc_event_num_listeners count not cleared

[ Upstream commit c46bfba1337d301661dbb23cfd905d4cb51f27ca ]

When we register a cn_proc listening event, the proc_event_num_listener
variable will be incremented by one, but if PROC_CN_MCAST_IGNORE is
not called, the count will not decrease.
This will cause the proc_*_connector function to take the wrong path.
It will reappear when the forkstat tool exits via ctrl + c.
We solve this problem by determining whether
there are still listeners to clear proc_event_num_listener.

Signed-off-by: wangkeqi <wangkeqiwang@didiglobal.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/connector/cn_proc.c