Commit dd857d3c authored by Gerd Bayer's avatar Gerd Bayer Committed by Guo Mengqi
Browse files

net/mlx5: Fix error path in multi-packet WQE transmit

stable inclusion
from stable-v5.10.227
commit ca36d6c1a49b6965c86dd528a73f38bc62d9c625
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IAYRD9
CVE: CVE-2024-50001

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ca36d6c1a49b6965c86dd528a73f38bc62d9c625



--------------------------------

[ Upstream commit 2bcae12c795f32ddfbf8c80d1b5f1d3286341c32 ]

Remove the erroneous unmap in case no DMA mapping was established

The multi-packet WQE transmit code attempts to obtain a DMA mapping for
the skb. This could fail, e.g. under memory pressure, when the IOMMU
driver just can't allocate more memory for page tables. While the code
tries to handle this in the path below the err_unmap label it erroneously
unmaps one entry from the sq's FIFO list of active mappings. Since the
current map attempt failed this unmap is removing some random DMA mapping
that might still be required. If the PCI function now presents that IOVA,
the IOMMU may assumes a rogue DMA access and e.g. on s390 puts the PCI
function in error state.

The erroneous behavior was seen in a stress-test environment that created
memory pressure.

Fixes: 5af75c74 ("net/mlx5e: Enhanced TX MPWQE for SKBs")
Signed-off-by: default avatarGerd Bayer <gbayer@linux.ibm.com>
Reviewed-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
Acked-by: default avatarMaxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarGuo Mengqi <guomengqi3@huawei.com>
parent d51fb86c
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -601,7 +601,6 @@ mlx5e_sq_xmit_mpwqe(struct mlx5e_txqsq *sq, struct sk_buff *skb,
	return;

err_unmap:
	mlx5e_dma_unmap_wqe_err(sq, 1);
	sq->stats->dropped++;
	dev_kfree_skb_any(skb);
}