All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@nvidia.com>
To: "yuehaibing@huawei.com" <yuehaibing@huawei.com>,
	"tariqt@mellanox.com" <tariqt@mellanox.com>,
	Boris Pismenny <borisp@nvidia.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"leon@kernel.org" <leon@kernel.org>,
	"kuba@kernel.org" <kuba@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net/mlx5e: kTLS, Avoid kzalloc(GFP_KERNEL) under spinlock
Date: Tue, 1 Sep 2020 17:16:59 +0000	[thread overview]
Message-ID: <d92b28edfa72687114fe85c07cb1e190697485a0.camel@nvidia.com> (raw)
In-Reply-To: <20200901143512.25424-1-yuehaibing@huawei.com>

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@huawei.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.

      reply	other threads:[~2020-09-01 17:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 14:35 [PATCH net-next] net/mlx5e: kTLS, Avoid kzalloc(GFP_KERNEL) under spinlock YueHaibing
2020-09-01 17:16 ` Saeed Mahameed [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d92b28edfa72687114fe85c07cb1e190697485a0.camel@nvidia.com \
    --to=saeedm@nvidia.com \
    --cc=borisp@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tariqt@mellanox.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.