OSDN Git Service

xsk: Fix corrupted packets for XDP_SHARED_UMEM
authorMagnus Karlsson <magnus.karlsson@intel.com>
Fri, 12 Aug 2022 11:32:59 +0000 (13:32 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 15 Aug 2022 15:26:07 +0000 (17:26 +0200)
commit58ca14ed98c87cfe0d1408cc65a9745d9e9b7a56
treeb5147c832716f50fccee90819d5cab9c3a983b7e
parent27e23836ce22a3e5d89712ef832ab72e47ce9f43
xsk: Fix corrupted packets for XDP_SHARED_UMEM

Fix an issue in XDP_SHARED_UMEM mode together with aligned mode where
packets are corrupted for the second and any further sockets bound to
the same umem. In other words, this does not affect the first socket
bound to the umem. The culprit for this bug is that the initialization
of the DMA addresses for the pre-populated xsk buffer pool entries was
not performed for any socket but the first one bound to the umem. Only
the linear array of DMA addresses was populated. Fix this by populating
the DMA addresses in the xsk buffer pool for every socket bound to the
same umem.

Fixes: 94033cd8e73b8 ("xsk: Optimize for aligned case")
Reported-by: Alasdair McWilliam <alasdair.mcwilliam@outlook.com>
Reported-by: Intrusion Shield Team <dnevil@intrusion.com>
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Alasdair McWilliam <alasdair.mcwilliam@outlook.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/xdp-newbies/6205E10C-292E-4995-9D10-409649354226@outlook.com/
Link: https://lore.kernel.org/bpf/20220812113259.531-1-magnus.karlsson@gmail.com
net/xdp/xsk_buff_pool.c