mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Horia Geanta <horia.geanta@nxp.com>
To: Aleksandr Aprelkov <aaprelkov@usergate.com>
Cc: Pankaj Gupta <pankaj.gupta@nxp.com>,
	Gaurav Jain <gaurav.jain@nxp.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>
Subject: Re: [PATCH] crypto: caam/qi2 - check for 0 rx/tx queues on setup
Date: Mon, 1 Apr 2024 14:22:01 +0000	[thread overview]
Message-ID: <d75ba54c-5854-4e6c-b59b-57b576e8c083@nxp.com> (raw)
In-Reply-To: <20240401082620.608675-1-aaprelkov@usergate.com>

On 4/1/2024 11:26 AM, Aleksandr Aprelkov wrote:
> If num_rx_queues or num_tx_queues is 0, then division by zero occurs
> on j calculation.
> Also goto mark "err_get_rx_queue" used for tx queues too.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 8d818c105501 ("crypto: caam/qi2 - add DPAA2-CAAM driver")
> Signed-off-by: Aleksandr Aprelkov <aaprelkov@usergate.com>
> ---
>  drivers/crypto/caam/caamalg_qi2.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c
> index a4f6884416a0..07cb1aad758f 100644
> --- a/drivers/crypto/caam/caamalg_qi2.c
> +++ b/drivers/crypto/caam/caamalg_qi2.c
> @@ -5049,6 +5049,11 @@ static int __cold dpaa2_dpseci_setup(struct fsl_mc_device *ls_dev)
>  
>  	priv->num_pairs = min(priv->dpseci_attr.num_rx_queues,
>  			      priv->dpseci_attr.num_tx_queues);
> +	if (!priv->num_pairs) {
> +		err = -EINVAL;
> +		dev_err(dev, "one of queues number is 0\n");
> +		goto err_get_queues;
> +	}
dpseci objects are created in MC f/w using restool: https://github.com/nxp-qoriq/restool
restool validates the user-provided attributes of these objects,
including num_{rx,tx}_queues - which can't be zero, they must be at least 1.

More details in source code:
https://github.com/nxp-qoriq/restool/blob/master/dpseci_commands.c#L713
https://github.com/nxp-qoriq/restool/blob/master/dpseci_commands.c#L633

So thanks, but I don't think this check is required.

Horia


      reply	other threads:[~2024-04-01 14:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-01  8:26 Aleksandr Aprelkov
2024-04-01 14:22 ` Horia Geanta [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=d75ba54c-5854-4e6c-b59b-57b576e8c083@nxp.com \
    --to=horia.geanta@nxp.com \
    --cc=aaprelkov@usergate.com \
    --cc=davem@davemloft.net \
    --cc=gaurav.jain@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=pankaj.gupta@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®