]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
crypto: atmel-sha204a - Fix potential UAF and memory leak in remove path
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 14 Mar 2026 19:36:29 +0000 (20:36 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 22 Mar 2026 02:17:59 +0000 (11:17 +0900)
commitbab1adf3b87e4bfac92c4f5963c63db434d561c1
tree216f8d5d540b7596f83571c199dee95c2a0f087f
parentc8c4a2972f83c8b68ff03b43cecdb898939ff851
crypto: atmel-sha204a - Fix potential UAF and memory leak in remove path

Unregister the hwrng to prevent new ->read() calls and flush the Atmel
I2C workqueue before teardown to prevent a potential UAF if a queued
callback runs while the device is being removed.

Drop the early return to ensure sysfs entries are removed and
->hwrng.priv is freed, preventing a memory leak.

Fixes: da001fb651b0 ("crypto: atmel-i2c - add support for SHA204A random number generator")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-sha204a.c