From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 697FB34A3DF for ; Mon, 4 May 2026 08:48:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777884500; cv=none; b=UIvznTlzWeOn0HfCc4+kKbREBpe8Wnf2TI7FkCq5OY6r70+gWcZ1yRR5TV6/4VeqcIYMyVD0aitvh4UH2f6+5w8RM/e09gsF5Z4g8u5EN8z/iA2OA2hzZdaSBgCpB/jvaqz/eEU2oOUufRInhnPxzjRV/tv+sCRsxrMWm38MlIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777884500; c=relaxed/simple; bh=b2xbGtfrqjr9dQSsB8uORreN+WiDV6+bdD4RnTwbzkg=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=nJp8rgvMH+VG9BbzLUkcVe5g3GPHhhZQGk3607m7an2kqQon/Qt7OFo3FHRkcQISe2tO4RlVXU36KvxJV1r/pkC4+7ryLeA+F9niSrwBk1YhIAU4zJEwonNf7RtIFzatyTrw833MO0ZeT8LgKmUj7Xnk8PLzztk2wqQ5BB5XYy4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xXPM176k; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xXPM176k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA3AEC2BCB8; Mon, 4 May 2026 08:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777884500; bh=b2xbGtfrqjr9dQSsB8uORreN+WiDV6+bdD4RnTwbzkg=; h=Subject:To:Cc:From:Date:From; b=xXPM176khSJGPof8gU10+v4RWW016MeW0GeyAycSBc65eFYL1h2ADpZW5IUu5HlvA Xcwb3KbRYTAQYt4kJq4ncNvIDGplHVDK3zj6VQF3GCgjp3sycK+2vrwKXMMrU2S3gB tsODNpx4KcoQgQ9N5q36aBSmgp4oiS+77DAE6PC8= Subject: FAILED: patch "[PATCH] crypto: atmel-sha204a - Fix potential UAF and memory leak in" failed to apply to 5.15-stable tree To: thorsten.blum@linux.dev,herbert@gondor.apana.org.au Cc: From: Date: Mon, 04 May 2026 10:48:17 +0200 Message-ID: <2026050417-strangle-guy-d0dc@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x bab1adf3b87e4bfac92c4f5963c63db434d561c1 # git commit -s git send-email --to '' --in-reply-to '2026050417-strangle-guy-d0dc@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From bab1adf3b87e4bfac92c4f5963c63db434d561c1 Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Sat, 14 Mar 2026 20:36:29 +0100 Subject: [PATCH] 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 Signed-off-by: Herbert Xu diff --git a/drivers/crypto/atmel-sha204a.c b/drivers/crypto/atmel-sha204a.c index 691531647fd6..dbb39ed0cea1 100644 --- a/drivers/crypto/atmel-sha204a.c +++ b/drivers/crypto/atmel-sha204a.c @@ -194,10 +194,8 @@ static void atmel_sha204a_remove(struct i2c_client *client) { struct atmel_i2c_client_priv *i2c_priv = i2c_get_clientdata(client); - if (atomic_read(&i2c_priv->tfm_count)) { - dev_emerg(&client->dev, "Device is busy, will remove it anyhow\n"); - return; - } + devm_hwrng_unregister(&client->dev, &i2c_priv->hwrng); + atmel_i2c_flush_queue(); sysfs_remove_group(&client->dev.kobj, &atmel_sha204a_groups);