[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZTrvcHEC/rU1G4ct@x130>
Date: Thu, 26 Oct 2023 16:00:00 -0700
From: Saeed Mahameed <saeed@...nel.org>
To: Dust Li <dust.li@...ux.alibaba.com>
Cc: Saeed Mahameed <saeedm@...dia.com>, Leon Romanovsky <leon@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org,
Cruz Zhao <cruzzhao@...ux.alibaba.com>,
Tianchen Ding <dtcccc@...ux.alibaba.com>
Subject: Re: [PATCH net] net/mlx5e: fix double free of encap_header
On 25 Oct 11:27, Dust Li wrote:
>When mlx5_packet_reformat_alloc() fails, the encap_header allocated in
>mlx5e_tc_tun_create_header_ipv4{6} will be released within it. However,
>e->encap_header is already set to the previously freed encap_header
>before mlx5_packet_reformat_alloc(). As a result, the later
>mlx5e_encap_put() will free e->encap_header again, causing a double free
>issue.
>
>mlx5e_encap_put()
> --> mlx5e_encap_dealloc()
> --> kfree(e->encap_header)
>
>This happens when cmd: MLX5_CMD_OP_ALLOC_PACKET_REFORMAT_CONTEXT fail.
>
>This patch fix it by not setting e->encap_header until
>mlx5_packet_reformat_alloc() success.
>
>Fixes: d589e785baf5e("net/mlx5e: Allow concurrent creation of encap entries")
>Reported-by: Cruz Zhao <cruzzhao@...ux.alibaba.com>
>Reported-by: Tianchen Ding <dtcccc@...ux.alibaba.com>
>Signed-off-by: Dust Li <dust.li@...ux.alibaba.com>
Applied to net-mlx5
Powered by blists - more mailing lists