Commit 287b1b97 authored by Stefano Brivio's avatar Stefano Brivio Committed by Kleber Sacilotto de Souza

skbuff: Unconditionally copy pfmemalloc in __skb_clone()

BugLink: https://bugs.launchpad.net/bugs/1791080

[ Upstream commit e78bfb07 ]

Commit 8b700862 ("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: default avatarSabrina Dubroca <sd@queasysnail.net>
Fixes: 8b700862 ("net: Don't copy pfmemalloc flag in __copy_skb_header()")
Signed-off-by: default avatarStefano Brivio <sbrivio@redhat.com>
Tested-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent f7f91d95
......@@ -899,8 +899,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment