diff mbox series

netlink: Unset cb_running when terminating dump on release

Message ID aff028e3eb2b768b9895fa6349fa1981ae22f098.camel@oracle.com (mailing list archive)
State Accepted
Commit 438989137acd6c620e9990c24dead5ffdd8e77c1
Delegated to: Netdev Maintainers
Headers show
Series netlink: Unset cb_running when terminating dump on release | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: horms@kernel.org
netdev/build_clang success Errors and warnings before: 1 this patch: 1
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 3 this patch: 3
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 7 this patch: 7
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-15--18-00 (tests: 891)

Commit Message

Siddh Raman Pant Feb. 15, 2025, 9:40 a.m. UTC
When we terminated the dump, the callback isn't running, so cb_running
should be set to false to be logically consistent.

cb_running signifies whether a dump is ongoing. It is set to true in
cb->start(), and is checked in netlink_dump() to be true initially.
After the dump, it is set to false in the same function.

When we terminate a dump before it ends (see 1904fb9ebf91 ("netlink:
terminate outstanding dump on socket close")), we do not unset the
boolean flag cb_running. This is wrong - since the dump is no longer
running (we terminated it), it must be set to false to convey the
correct state.

Signed-off-by: Siddh Raman Pant <siddh.raman.pant@oracle.com>
---
 net/netlink/af_netlink.c | 1 +
 1 file changed, 1 insertion(+)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 19, 2025, 2:10 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 15 Feb 2025 09:40:51 +0000 you wrote:
> When we terminated the dump, the callback isn't running, so cb_running
> should be set to false to be logically consistent.
> 
> cb_running signifies whether a dump is ongoing. It is set to true in
> cb->start(), and is checked in netlink_dump() to be true initially.
> After the dump, it is set to false in the same function.
> 
> [...]

Here is the summary with links:
  - netlink: Unset cb_running when terminating dump on release
    https://git.kernel.org/netdev/net-next/c/438989137acd

You are awesome, thank you!
diff mbox series

Patch

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);