Re: Problem in pfmemalloc skb handling in net/core/dev.c

From: Xie He
Date: Fri Apr 09 2021 - 04:33:39 EST


On Fri, Apr 9, 2021 at 12:30 AM Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Under what circumstances do you expect sk_memalloc_socks() to be false
> and skb_pfmemalloc() to be true that would cause a problem?

For example, if at the time the skb is allocated,
"sk_memalloc_socks()" was true, then the skb might be allocated as a
pfmemalloc skb. However, if after this skb is allocated and before
this skb reaches "__netif_receive_skb", "sk_memalloc_socks()" has
changed from "true" to "false", then "__netif_receive_skb" will see
"sk_memalloc_socks()" being false and "skb_pfmemalloc(skb)" being
true.

This is a problem because this would cause a pfmemalloc skb to be
delivered to "taps" and protocols that don't support pfmemalloc skbs.