[RFC PATCH] netlink: Unset cb_running when terminating dump on release.

From: Siddh Raman Pant
Date: Fri Feb 14 2025 - 01:59:41 EST


When we terminated the dump, the callback isn't running, so cb_running
should be set to false to be logically consistent.

Fixes: 1904fb9ebf91 ("netlink: terminate outstanding dump on socket close")
Fixes: 16b304f3404f ("netlink: Eliminate kmalloc in netlink dump operation.")
Signed-off-by: Siddh Raman Pant <siddh.raman.pant@xxxxxxxxxx>
---
I found this by inspection and was thinking why it isn't being done. So
I thought I should ask by sending a patch.

net/netlink/af_netlink.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 85311226183a..f8f13058a46e 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -771,6 +771,7 @@ static int netlink_release(struct socket *sock)
nlk->cb.done(&nlk->cb);
module_put(nlk->cb.module);
kfree_skb(nlk->cb.skb);
+ WRITE_ONCE(nlk->cb_running, false);
}

module_put(nlk->module);
--
2.45.2