OSDN Git Service

skbuff: Unconditionally copy pfmemalloc in __skb_clone()
authorStefano Brivio <sbrivio@redhat.com>
Fri, 13 Jul 2018 11:21:07 +0000 (13:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Jul 2018 08:18:17 +0000 (10:18 +0200)
commit80a80f51cc3aeea3d7d9d2b859357f611de7a87d
tree6c5f3787a02cd3d258c31b2e302b2650b5dd2990
parentd629be850ac6e296dfe156604d7bb5202f1613da
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>
net/core/skbuff.c