Message ID | 20211014081050.3041204-1-matt@codeconstruct.com.au (mailing list archive) |
---|---|
State | Accepted |
Commit | 0b93aed2842d950e8d2625e975e5a57febeff33d |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,v2] mctp: Avoid leak of mctp_sk_key | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Single patches do not need cover letters |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 5 of 5 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 2 this patch: 2 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Fixes tag looks correct |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 16 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 2 this patch: 2 |
netdev/header_inline | success | No static functions without inline keyword in header files |
Hello: This patch was applied to netdev/net-next.git (master) by David S. Miller <davem@davemloft.net>: On Thu, 14 Oct 2021 16:10:50 +0800 you wrote: > mctp_key_alloc() returns a key already referenced. > > The mctp_route_input() path receives a packet for a bind socket and > allocates a key. It passes the key to mctp_key_add() which takes a > refcount and adds the key to lists. mctp_route_input() should then > release its own refcount when setting the key pointer to NULL. > > [...] Here is the summary with links: - [net-next,v2] mctp: Avoid leak of mctp_sk_key https://git.kernel.org/netdev/net-next/c/0b93aed2842d You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/mctp/route.c b/net/mctp/route.c index 04781459b2be..82fb5ae524f6 100644 --- a/net/mctp/route.c +++ b/net/mctp/route.c @@ -372,6 +372,7 @@ static int mctp_route_input(struct mctp_route *route, struct sk_buff *skb) trace_mctp_key_acquire(key); /* we don't need to release key->lock on exit */ + mctp_key_unref(key); key = NULL; } else { @@ -584,6 +585,9 @@ static int mctp_alloc_local_tag(struct mctp_sock *msk, trace_mctp_key_acquire(key); *tagp = key->tag; + /* done with the key in this scope */ + mctp_key_unref(key); + key = NULL; rc = 0; }