]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commita7dc26f33365329b809f6152404401f9d8d133e1
treeb5147c832716f50fccee90819d5cab9c3a983b7e
parentc2dd4221316944f44ba047593b6de6ad16ac9cc5
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: be9a4c678e3b7 ("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