Skip to content

Commit cab41c4

Browse files
Alexander Duyckdavem330
authored andcommitted
skb: Add documentation for skb_clone_sk
This change adds some documentation to the call skb_clone_sk. This is meant to help clarify the purpose of the function for other developers. Signed-off-by: Alexander Duyck <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 72b126a commit cab41c4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

net/core/skbuff.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3511,6 +3511,19 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk)
35113511
}
35123512
EXPORT_SYMBOL(sock_dequeue_err_skb);
35133513

3514+
/**
3515+
* skb_clone_sk - create clone of skb, and take reference to socket
3516+
* @skb: the skb to clone
3517+
*
3518+
* This function creates a clone of a buffer that holds a reference on
3519+
* sk_refcnt. Buffers created via this function are meant to be
3520+
* returned using sock_queue_err_skb, or free via kfree_skb.
3521+
*
3522+
* When passing buffers allocated with this function to sock_queue_err_skb
3523+
* it is necessary to wrap the call with sock_hold/sock_put in order to
3524+
* prevent the socket from being released prior to being enqueued on
3525+
* the sk_error_queue.
3526+
*/
35143527
struct sk_buff *skb_clone_sk(struct sk_buff *skb)
35153528
{
35163529
struct sock *sk = skb->sk;

0 commit comments

Comments
 (0)