]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Sep 2022 09:23:57 +0000 (11:23 +0200)
commit2c75891d56ab6fe5ba0d415bfad91d514a4027cd
tree4a5f951a466cfb402b6a1607b20b6c7ad4e7dfe8
parentc77b724cddfb8ac1291a60e3e68937e62cbfc5e0
xsk: Fix corrupted packets for XDP_SHARED_UMEM

[ Upstream commit 58ca14ed98c87cfe0d1408cc65a9745d9e9b7a56 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/xdp/xsk_buff_pool.c