* [PATCH net] skbuff: Unconditionally copy pfmemalloc in __skb_clone()
@ 2018-07-13 11:21 Stefano Brivio
2018-07-13 12:45 ` Sabrina Dubroca
2018-07-13 21:28 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Stefano Brivio @ 2018-07-13 11:21 UTC (permalink / raw)
To: David S. Miller
Cc: Sabrina Dubroca, Mel Gorman, Eric Dumazet, Patrick Talbert,
netdev
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>
---
net/core/skbuff.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4df3164bb5fc..8e51f8555e11 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -858,8 +858,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);
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] skbuff: Unconditionally copy pfmemalloc in __skb_clone()
2018-07-13 11:21 [PATCH net] skbuff: Unconditionally copy pfmemalloc in __skb_clone() Stefano Brivio
@ 2018-07-13 12:45 ` Sabrina Dubroca
2018-07-13 21:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Sabrina Dubroca @ 2018-07-13 12:45 UTC (permalink / raw)
To: Stefano Brivio
Cc: David S. Miller, Mel Gorman, Eric Dumazet, Patrick Talbert,
netdev
2018-07-13, 13:21:07 +0200, Stefano Brivio wrote:
> 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>
Thanks,
Tested-by: Sabrina Dubroca <sd@queasysnail.net>
--
Sabrina
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] skbuff: Unconditionally copy pfmemalloc in __skb_clone()
2018-07-13 11:21 [PATCH net] skbuff: Unconditionally copy pfmemalloc in __skb_clone() Stefano Brivio
2018-07-13 12:45 ` Sabrina Dubroca
@ 2018-07-13 21:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-07-13 21:28 UTC (permalink / raw)
To: sbrivio; +Cc: sd, mgorman, eric.dumazet, ptalbert, netdev
From: Stefano Brivio <sbrivio@redhat.com>
Date: Fri, 13 Jul 2018 13:21:07 +0200
> 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-13 21:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-13 11:21 [PATCH net] skbuff: Unconditionally copy pfmemalloc in __skb_clone() Stefano Brivio
2018-07-13 12:45 ` Sabrina Dubroca
2018-07-13 21:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).