public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* resource leak in firmware/arm_scmi driver
@ 2022-10-10  8:45 Uwe Kleine-König
  2022-10-13 11:48 ` Cristian Marussi
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2022-10-10  8:45 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi; +Cc: linux-arm-kernel, kernel


[-- Attachment #1.1: Type: text/plain, Size: 984 bytes --]

Hello,

during some janitorial cleanup I stumbled over a resource leak in
drivers/firmware/arm_scmi/driver.c.

The problem is as follows:

scmi_remove() might return early if info->users is non-zero. The driver
core however ignores the return value of scmi_remove() and removes the
device and frees the devm-allocated resources (e.g. *info).

So letting aside that some resources are never freed after a failed call
of scmi_remove(), the user of the scmi node will probably stumble over
accessing freed memory soon. I wouldn't be surprised if that was
exploitable.

I quickly tried to fix this issue, but didn't understand the driver good
enough. I think a fix would involve adding a get_device() call to
scmi_handle_get() to prevent scmi_remove() being called while a handle
exists.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-13 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-10  8:45 resource leak in firmware/arm_scmi driver Uwe Kleine-König
2022-10-13 11:48 ` Cristian Marussi
2022-10-13 15:49   ` Uwe Kleine-König

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