lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <112892c8-c915-6ae0-f76b-23285fb73efc@mellanox.com>
Date:   Tue, 31 Jul 2018 09:35:37 +0300
From:   Tariq Toukan <tariqt@...lanox.com>
To:     Jesper Dangaard Brouer <brouer@...hat.com>,
        Saeed Mahameed <saeedm@...lanox.com>,
        Tariq Toukan <tariqt@...lanox.com>
Cc:     netdev@...r.kernel.org, eugenia@...lanox.com
Subject: Re: [net-next PATCH] mlx5: handle DMA mapping error case for XDP
 redirect



On 30/07/2018 8:49 PM, Jesper Dangaard Brouer wrote:
> Commit 58b99ee3e3eb ("net/mlx5e: Add support for XDP_REDIRECT in device-out side")
> forgot to return/free the xdp_frame in case the DMA mapping failed, correct this.
> 
> Also DMA unmap the frame in case mlx5e_xmit_xdp_frame() fails.
> 
> Fixes: 58b99ee3e3eb ("net/mlx5e: Add support for XDP_REDIRECT in device-out side")
> Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c |    3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
> index bab8cd44d1c5..1881468dbcfa 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
> @@ -283,6 +283,7 @@ int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
>   		xdpi.dma_addr = dma_map_single(sq->pdev, xdpf->data, xdpf->len,
>   					       DMA_TO_DEVICE);
>   		if (unlikely(dma_mapping_error(sq->pdev, xdpi.dma_addr))) {
> +			xdp_return_frame_rx_napi(xdpf);
>   			drops++;
>   			continue;
>   		}
> @@ -290,6 +291,8 @@ int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
>   		xdpi.xdpf = xdpf;
>   
>   		if (unlikely(!mlx5e_xmit_xdp_frame(sq, &xdpi))) {
> +			dma_unmap_single(sq->pdev, xdpi.dma_addr,
> +					 xdpf->len, DMA_TO_DEVICE);
>   			xdp_return_frame_rx_napi(xdpf);
>   			drops++;
>   		}
> 
Reviewed-by: Tariq Toukan <tariqt@...lanox.com>

Thanks Jesper!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ