[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d92b28edfa72687114fe85c07cb1e190697485a0.camel@nvidia.com>
Date: Tue, 1 Sep 2020 17:16:59 +0000
From: Saeed Mahameed <saeedm@...dia.com>
To: "yuehaibing@...wei.com" <yuehaibing@...wei.com>,
"tariqt@...lanox.com" <tariqt@...lanox.com>,
Boris Pismenny <borisp@...dia.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"leon@...nel.org" <leon@...nel.org>,
"kuba@...nel.org" <kuba@...nel.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] net/mlx5e: kTLS, Avoid kzalloc(GFP_KERNEL) under
spinlock
On Tue, 2020-09-01 at 22:35 +0800, YueHaibing wrote:
> A spin lock is held before kzalloc, it may sleep with holding
> the spinlock, so we should use GFP_ATOMIC instead.
>
> This is detected by coccinelle.
>
> Fixes: 0419d8c9d8f8 ("net/mlx5e: kTLS, Add kTLS RX resync support")
> Signed-off-by: YueHaibing <yuehaibing@...wei.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git
> a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
> b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
> index acf6d80a6bb7..1a32435acac3 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
> @@ -247,7 +247,7 @@ resync_post_get_progress_params(struct
> mlx5e_icosq *sq,
> int err;
> u16 pi;
>
> - buf = kzalloc(sizeof(*buf), GFP_KERNEL);
> + buf = kzalloc(sizeof(*buf), GFP_ATOMIC);
> if (unlikely(!buf)) {
> err = -ENOMEM;
> goto err_out;
Thanks for the patch, the kzalloc can move outside the spinlock.
This patch should also go to net.
I will provide a newer version of the patch to deal with this and with
a missing kfree on error handling i found while looking at the code.
Thanks,
Saeed.
Powered by blists - more mailing lists