diff options
author | Ilias Apalodimas <[email protected]> | 2021-07-16 10:02:18 +0300 |
---|---|---|
committer | David S. Miller <[email protected]> | 2021-07-16 11:37:00 -0700 |
commit | 2cc3aeb5ecccec0d266813172fcd82b4b5fa5803 (patch) | |
tree | 2f8486b71126e60458c257fd72c0561a8e68b8e6 /net/unix/unix_bpf.c | |
parent | 20192d9c9f6ae447c461285c915502ffbddf5696 (diff) |
skbuff: Fix a potential race while recycling page_pool packets
As Alexander points out, when we are trying to recycle a cloned/expanded
SKB we might trigger a race. The recycling code relies on the
pp_recycle bit to trigger, which we carry over to cloned SKBs.
If that cloned SKB gets expanded or if we get references to the frags,
call skb_release_data() and overwrite skb->head, we are creating separate
instances accessing the same page frags. Since the skb_release_data()
will first try to recycle the frags, there's a potential race between
the original and cloned SKB, since both will have the pp_recycle bit set.
Fix this by explicitly those SKBs not recyclable.
The atomic_sub_return effectively limits us to a single release case,
and when we are calling skb_release_data we are also releasing the
option to perform the recycling, or releasing the pages from the page pool.
Fixes: 6a5bcd84e886 ("page_pool: Allow drivers to hint on SKB recycling")
Reported-by: Alexander Duyck <[email protected]>
Suggested-by: Alexander Duyck <[email protected]>
Reviewed-by: Alexander Duyck <[email protected]>
Acked-by: Jesper Dangaard Brouer <[email protected]>
Signed-off-by: Ilias Apalodimas <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/unix/unix_bpf.c')
0 files changed, 0 insertions, 0 deletions