aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorEric Dumazet <[email protected]>2024-10-10 17:48:15 +0000
committerJakub Kicinski <[email protected]>2024-10-15 00:39:36 +0000
commit5ced52fa8f0dc23adb067f7b8a009a5ee051efb7 (patch)
treef9c567b91223fee5b5af62f82d8fa5846600a996 /net/core/sock.c
parentnet_sched: sch_fq: prepare for TIME_WAIT sockets (diff)
downloadkernel-5ced52fa8f0dc23adb067f7b8a009a5ee051efb7.tar.gz
kernel-5ced52fa8f0dc23adb067f7b8a009a5ee051efb7.zip
net: add skb_set_owner_edemux() helper
This can be used to attach a socket to an skb, taking a reference on sk->sk_refcnt. This helper might be a NOP if sk->sk_refcnt is zero. Use it from tcp_make_synack(). Signed-off-by: Eric Dumazet <[email protected]> Reviewed-by: Kuniyuki Iwashima <[email protected]> Reviewed-by: Brian Vazquez <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 083d438d8b6f..f8c0d4eda888 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2592,14 +2592,11 @@ void __sock_wfree(struct sk_buff *skb)
void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
{
skb_orphan(skb);
- skb->sk = sk;
#ifdef CONFIG_INET
- if (unlikely(!sk_fullsock(sk))) {
- skb->destructor = sock_edemux;
- sock_hold(sk);
- return;
- }
+ if (unlikely(!sk_fullsock(sk)))
+ return skb_set_owner_edemux(skb, sk);
#endif
+ skb->sk = sk;
skb->destructor = sock_wfree;
skb_set_hash_from_sk(skb, sk);
/*