summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2018-07-13 13:21:07 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-25 11:24:02 +0200
commitad375eae791f92deac62a062c176903b6215e6a2 (patch)
tree6751fc8db108db8b7e9fa4063a5829d107783bb2 /net
parentcad99229aa2048f8b0d9dd7208577603397e65a2 (diff)
skbuff: Unconditionally copy pfmemalloc in __skb_clone()
[ Upstream commit e78bfb0751d4e312699106ba7efbed2bab1a53ca ] 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. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/core/skbuff.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 36a70b2192db..8cae7aa4a4ec 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -904,8 +904,7 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
n->cloned = 1;
n->nohdr = 0;
n->peeked = 0;
- if (skb->pfmemalloc)
- n->pfmemalloc = 1;
+ C(pfmemalloc);
n->destructor = NULL;
C(tail);
C(end);