Thread (6 messages) 6 messages, 3 authors, 2025-02-18

Re: [PATCH] soc: apple: rtkit: Fix use-after-free in apple_rtkit_crashlog_rx()

From: Sven Peter <hidden>
Date: 2025-02-18 15:34:41
Also in: asahi, kernel-janitors, lkml

Hi,


On Wed, Feb 12, 2025, at 09:58, Harshit Mogalapalli wrote:
This code calls kfree(bfr); and then passes "bfr" to rtk->ops->crashed()
which is a use after free.  The ->crashed function pointer is implemented
by apple_nvme_rtkit_crashed() and it doesn't use the "bfr" pointer so
this doesn't cause a problem.  But it still looks sketchy as can be.

Fix this by moving kfree() after the last usage of bfr.

Fixes: c559645f343a ("soc: apple: rtkit: Pass the crashlog to the 
crashed() callback")
This commit isn't upstream yet afaict, did you mean to post a review comment
to [1] instead?


[1] https://lore.kernel.org/asahi/20250202-rtkit-crashdump-v1-1-9d38615b4e12@asahilina.net/ (local)


Best,


Sven
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help