[PATCH net] af_unix: Correct comment to reference kfree_skb_reason hook

Liang Jie posted 1 patch 6 days, 3 hours ago
net/unix/af_unix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH net] af_unix: Correct comment to reference kfree_skb_reason hook
Posted by Liang Jie 6 days, 3 hours ago
From: Liang Jie <liangjie@lixiang.com>

The comment in unix_release_sock has been updated to correctly reference
kfree_skb_reason instead of kfree_skb, for clarity on how passed file
descriptors are handled during socket closure.

Fixes: c32f0bd7d483 ("af_unix: Set drop reason in unix_release_sock().")
Signed-off-by: Liang Jie <liangjie@lixiang.com>
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 34945de1fb1f..47dd3749ce32 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -717,7 +717,7 @@ static void unix_release_sock(struct sock *sk, int embrion)
 		if (state == TCP_LISTEN)
 			unix_release_sock(skb->sk, 1);
 
-		/* passed fds are erased in the kfree_skb hook */
+		/* passed fds are erased in the kfree_skb_reason hook */
 		kfree_skb_reason(skb, SKB_DROP_REASON_SOCKET_CLOSE);
 	}
 
-- 
2.25.1
Re: [PATCH net] af_unix: Correct comment to reference kfree_skb_reason hook
Posted by Kuniyuki Iwashima 6 days, 2 hours ago
From: Liang Jie <buaajxlj@163.com>
Date: Fri, 24 Jan 2025 09:51:06 +0800
> From: Liang Jie <liangjie@lixiang.com>
> 
> The comment in unix_release_sock has been updated to correctly reference
> kfree_skb_reason instead of kfree_skb, for clarity on how passed file
> descriptors are handled during socket closure.
> 
> Fixes: c32f0bd7d483 ("af_unix: Set drop reason in unix_release_sock().")

This is net-next material and Fixes tag is not needed.

I don't think we need to update the comment though..

kfree_skb 'hook' generally means skb->destructor() and _reason is
not relevant here.

kfree_skb
  kfree_skb_reason
    sk_skb_reason_drop
      __kfree_skb
        skb_release_all
          skb_release_head_state
            skb->destructor / unix_destruct_scm <--


> Signed-off-by: Liang Jie <liangjie@lixiang.com>
> ---
>  net/unix/af_unix.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 34945de1fb1f..47dd3749ce32 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -717,7 +717,7 @@ static void unix_release_sock(struct sock *sk, int embrion)
>  		if (state == TCP_LISTEN)
>  			unix_release_sock(skb->sk, 1);
>  
> -		/* passed fds are erased in the kfree_skb hook */
> +		/* passed fds are erased in the kfree_skb_reason hook */
>  		kfree_skb_reason(skb, SKB_DROP_REASON_SOCKET_CLOSE);
>  	}
>  
> -- 
> 2.25.1