Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org
Subject: [bug report] crypto: algboss - Pass instance creation error up
Date: Wed, 11 Sep 2024 11:08:01 +0300	[thread overview]
Message-ID: <7f5c4907-ac4f-4b41-90d0-e00c1e552bf6@stanley.mountain> (raw)

Hello Herbert Xu,

Commit 795f85fca229 ("crypto: algboss - Pass instance creation error
up") from Sep 1, 2024 (linux-next), leads to the following Smatch
static checker warning:

	crypto/algboss.c:67 cryptomgr_probe()
	warn: passing zero to 'ERR_PTR'

crypto/algboss.c
    50 static int cryptomgr_probe(void *data)
    51 {
    52         struct cryptomgr_param *param = data;
    53         struct crypto_template *tmpl;
    54         int err = -ENOENT;
    55 
    56         tmpl = crypto_lookup_template(param->template);
    57         if (!tmpl)
    58                 goto out;
    59 
    60         do {
    61                 err = tmpl->create(tmpl, param->tb);
    62         } while (err == -EAGAIN && !signal_pending(current));
    63 
    64         crypto_tmpl_put(tmpl);
    65 
    66 out:
--> 67         param->larval->adult = ERR_PTR(err);

I wasn't able to find anything which was using this code...

This is assigned on both the success and failure paths so it means that
crypto_larval_destroy() never calls crypto_mod_put(larval->adult).  But I don't
really understand this code well so maybe there is nothing to free at this
point.

    68         param->larval->alg.cra_flags |= CRYPTO_ALG_DEAD;
    69         complete_all(&param->larval->completion);
    70         crypto_alg_put(&param->larval->alg);
    71         kfree(param);
    72         module_put_and_kthread_exit(0);
    73 }

regards,
dan carpenter

             reply	other threads:[~2024-09-11  8:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  8:08 Dan Carpenter [this message]
2024-09-11  8:12 ` [bug report] crypto: algboss - Pass instance creation error up Herbert Xu

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=7f5c4907-ac4f-4b41-90d0-e00c1e552bf6@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    /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