Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] misc: sram: do not allow unbinding the device
@ 2026-11-28  4:42 Rosen Penev
  0 siblings, 0 replies; only message in thread
From: Rosen Penev @ 2026-11-28  4:42 UTC (permalink / raw)
  To: linux-kernel, Greg Kroah-Hartman, Arnd Bergmann
  Cc: Shawn Guo, Andrew Morton, Philipp Zabel, Grant Likely, stable

Other drivers allocate from the SRAM pools and map the reserved regions,
with nothing tying their lifetime to the SRAM device. Unbinding it
through sysfs destroys the pools under them: sram_remove() notices and
prints "removed while SRAM allocated", but carries on, and the devm
release of the pool then hits the BUG_ON() in gen_pool_destroy() for
the outstanding allocations.

Seen on an Armada 385 with the CESA crypto engine holding its buffers in
an mmio-sram region:

  # echo f1100000.sa-sram0 > /sys/bus/platform/drivers/sram/unbind
  sram f1100000.sa-sram0: removed while SRAM allocated
  Internal error: Oops - undefined instruction: 0 [#1] SMP ARM

The driver cannot be built as a module, so suppress the bind attributes
and with them the only way to remove it.

Fixes: 4984c6f5e56c ("misc: generic on-chip SRAM allocation driver")
Cc: stable@vger.kernel.org
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
An AI coding assistant (Claude Code, Claude Opus 5.5) was used to find
this while reviewing the CESA driver, reproduce it on the board, and
write the patch and its commit message.

 drivers/misc/sram.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index c5110c32f661..fed949de60f5 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -450,6 +450,7 @@ static struct platform_driver sram_driver = {
 	.driver = {
 		.name = "sram",
 		.of_match_table = sram_dt_ids,
+		.suppress_bind_attrs = true,
 	},
 	.probe = sram_probe,
 	.remove = sram_remove,

base-commit: 917fcbf033154a6c8d83cfa6c88f012b71eb37b2
-- 
2.56.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-28  4:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28  4:42 [PATCH] misc: sram: do not allow unbinding the device Rosen Penev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox