Linux cryptographic layer development
 help / color / mirror / Atom feed
From: T Pratham <t-pratham@ti.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	Mert Seftali <mertsftl@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Dan Carpenter <error27@gmail.com>, <linux-crypto@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] crypto: ti - Use list_first_entry_or_null() in dthe_get_dev()
Date: Wed, 29 Jul 2026 17:25:46 +0530	[thread overview]
Message-ID: <f985e848-cc87-44b5-95ee-0533447e67f7@ti.com> (raw)
In-Reply-To: <akd0zGzVZSG_45hK@gondor.apana.org.au>

On 7/3/26 14:07, Herbert Xu wrote:
> On Sat, Jun 13, 2026 at 10:58:58AM +0200, Mert Seftali wrote:
>> dthe_get_dev() fetches a device from the global device list with
>> list_first_entry() and then checks the result for NULL. However,
>> list_first_entry() never returns NULL: on an empty list it returns a
>> bogus pointer computed from the list head. The NULL check is therefore
>> dead code, and an empty list would be treated as a valid entry and
>> moved around as if it were a real device.
>>
>> Use list_first_entry_or_null() so the existing NULL check works as
>> intended and an empty list is handled gracefully.
>>
>> Fixes: 52f641bc63a4 ("crypto: ti - Add driver for DTHE V2 AES Engine (ECB, CBC)")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Reported-by: Dan Carpenter <error27@gmail.com>
>> Closes: https://lore.kernel.org/r/202606111933.69GGTKxr-lkp@intel.com/
>> Signed-off-by: Mert Seftali <mertsftl@gmail.com>
>> ---
>>  drivers/crypto/ti/dthev2-common.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> This only fixes the symptom of the problem.  But the root goes
> deeper.
> 
> The main issue is that the device can go away in the middle of
> an operation.  The driver needs to be handle it gracefully, and
> certainly not by crashing the system because the associated memory
> has been freed.
> 
> Thanks,

This is not possible here as the device is part of the SoC. That being
said, I'll implement this handling to have a more correct driver. In the
meanwhile, the above empty list fix can be applied.

-- 
Regards
T Pratham <t-pratham@ti.com>

      parent reply	other threads:[~2026-07-29 11:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-13  8:58 [PATCH] crypto: ti - Use list_first_entry_or_null() in dthe_get_dev() Mert Seftali
2026-06-13 19:30 ` T Pratham
2026-07-03  8:37 ` Herbert Xu
2026-07-03 14:09   ` Mert Seftali
2026-07-29 11:55   ` T Pratham [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=f985e848-cc87-44b5-95ee-0533447e67f7@ti.com \
    --to=t-pratham@ti.com \
    --cc=davem@davemloft.net \
    --cc=error27@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mertsftl@gmail.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