Patch "xsk: Add truesize to skb_add_rx_frag()." has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    xsk: Add truesize to skb_add_rx_frag().

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xsk-add-truesize-to-skb_add_rx_frag.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5c74d3b37532d8842af68c825eafef8babc6c959
Author: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Date:   Fri Feb 2 17:32:20 2024 +0100

    xsk: Add truesize to skb_add_rx_frag().
    
    [ Upstream commit 2127c604383666675789fd4a5fc2aead46c73aad ]
    
    xsk_build_skb() allocates a page and adds it to the skb via
    skb_add_rx_frag() and specifies 0 for truesize. This leads to a warning
    in skb_add_rx_frag() with CONFIG_DEBUG_NET enabled because size is
    larger than truesize.
    
    Increasing truesize requires to add the same amount to socket's
    sk_wmem_alloc counter in order not to underflow the counter during
    release in the destructor (sock_wfree()).
    
    Pass the size of the allocated page as truesize to skb_add_rx_frag().
    Add this mount to socket's sk_wmem_alloc counter.
    
    Fixes: cf24f5a5feea ("xsk: add support for AF_XDP multi-buffer on Tx path")
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Acked-by: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20240202163221.2488589-1-bigeasy@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
index d849dc04a3343..2c3ba42bfcdcb 100644
--- a/net/xdp/xsk.c
+++ b/net/xdp/xsk.c
@@ -683,7 +683,8 @@ static struct sk_buff *xsk_build_skb(struct xdp_sock *xs,
 			memcpy(vaddr, buffer, len);
 			kunmap_local(vaddr);
 
-			skb_add_rx_frag(skb, nr_frags, page, 0, len, 0);
+			skb_add_rx_frag(skb, nr_frags, page, 0, len, PAGE_SIZE);
+			refcount_add(PAGE_SIZE, &xs->sk.sk_wmem_alloc);
 		}
 	}
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux