Skip to content

Commit e78bfb0

Browse files
sbrivio-rhdavem330
authored andcommitted
skbuff: Unconditionally copy pfmemalloc in __skb_clone()
Commit 8b70086 ("net: Don't copy pfmemalloc flag in __copy_skb_header()") introduced a different handling for the pfmemalloc flag in copy and clone paths. In __skb_clone(), now, the flag is set only if it was set in the original skb, but not cleared if it wasn't. This is wrong and might lead to socket buffers being flagged with pfmemalloc even if the skb data wasn't allocated from pfmemalloc reserves. Copy the flag instead of ORing it. Reported-by: Sabrina Dubroca <sd@queasysnail.net> Fixes: 8b70086 ("net: Don't copy pfmemalloc flag in __copy_skb_header()") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Tested-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8f19f12 commit e78bfb0

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎net/core/skbuff.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,7 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
858858
n->cloned = 1;
859859
n->nohdr = 0;
860860
n->peeked = 0;
861-
if (skb->pfmemalloc)
862-
n->pfmemalloc = 1;
861+
C(pfmemalloc);
863862
n->destructor = NULL;
864863
C(tail);
865864
C(end);

0 commit comments

Comments
 (0)