Netdev List
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Haoxiang Li <haoxiang_li2024@163.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org,
	 pabeni@redhat.com, kory.maincent@bootlin.com, zilin@seu.edu.cn,
	petrm@nvidia.com,  u.kleine-koenig@baylibre.com,
	marco.crivellari@suse.com, vadim.fedorenko@linux.dev,
	 Aleksey.Makarov@caviumnetworks.com,
	satananda.burla@caviumnetworks.com,
	 felix.manlunas@caviumnetworks.com,
	derek.chickles@caviumnetworks.com, rvatsavayi@caviumnetworks.com,
	 netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] net: liquidio: Check soft command allocation in lio_main setup_nic_devices()
Date: Tue, 23 Jun 2026 06:31:40 -0700	[thread overview]
Message-ID: <ajqKbaeXLvcLyN-0@gmail.com> (raw)
In-Reply-To: <20260623125611.2228149-1-haoxiang_li2024@163.com>

On Tue, Jun 23, 2026 at 08:56:11PM +0800, Haoxiang Li wrote:
> octeon_alloc_soft_command() returns NULL when the soft command buffer
> pool is empty. setup_nic_devices() dereferences the returned pointer
> immediately when preparing the interface configuration command, which
> can lead to a NULL pointer dereference if the pool is exhausted.
> 
> Return -ENOMEM when the allocation fails and let the existing NIC init
> failure path handle the error.
> 
> Fixes: f21fb3ed364b ("Add support of Cavium Liquidio ethernet adapters")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
>  drivers/net/ethernet/cavium/liquidio/lio_main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> index 0db08ac3d098..5077129656e8 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> @@ -3363,6 +3363,9 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
>  		sc = (struct octeon_soft_command *)
>  			octeon_alloc_soft_command(octeon_dev, data_size,
>  						  resp_size, 0);
> +		if (!sc)
> +			return -ENOMEM;

Is it fine to return in here, given that the
octeon_register_reqtype_free_fn()  and octeon_register_dispatch_fn()
functions succeed above? Do you need to clean any side effect by them?

--breno

      reply	other threads:[~2026-06-23 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 12:56 [PATCH] net: liquidio: Check soft command allocation in lio_main setup_nic_devices() Haoxiang Li
2026-06-23 13:31 ` Breno Leitao [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=ajqKbaeXLvcLyN-0@gmail.com \
    --to=leitao@debian.org \
    --cc=Aleksey.Makarov@caviumnetworks.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=derek.chickles@caviumnetworks.com \
    --cc=felix.manlunas@caviumnetworks.com \
    --cc=haoxiang_li2024@163.com \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco.crivellari@suse.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=rvatsavayi@caviumnetworks.com \
    --cc=satananda.burla@caviumnetworks.com \
    --cc=stable@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=vadim.fedorenko@linux.dev \
    --cc=zilin@seu.edu.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox