aboutsummaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2018-07-13 13:21:07 +0200
committerMoyster <oysterized@gmail.com>2019-05-03 19:24:03 +0200
commitb3168efe7a19401cc250e1cae149a55a777dd6f0 (patch)
tree77f7a6b6e53a09291dff87626376963bcbd5c668 /net/core
parent1f56c88dd71fe705d108c44d5ec6cd9588217e5b (diff)
skbuff: Unconditionally copy pfmemalloc in __skb_clone()
commit e78bfb0751d4e312699106ba7efbed2bab1a53ca upstream. Commit 8b7008620b84 ("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. Change-Id: I4f3f8ea55e9ee48b798cce0cc4cefb3510c5ba79 Reported-by: Sabrina Dubroca <sd@queasysnail.net> Fixes: 8b7008620b84 ("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> [bwh: Backported to 3.16: We didn't set the pfmemalloc flag in either copy or clone path until now] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/skbuff.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 2e5febb19..8953a95c2 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -733,6 +733,7 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
n->cloned = 1;
n->nohdr = 0;
n->peeked = 0;
+ C(pfmemalloc);
n->destructor = NULL;
C(tail);
C(end);