lkml.org 
[lkml]   [2019]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] rtc: 88pm860x: prevent use-after-free on device remove
On 26/04/2019 14:36:35-0400, Sven Van Asbroeck wrote:
> The device's remove() attempts to shut down the delayed_work scheduled
> on the kernel-global workqueue by calling flush_scheduled_work().
>
> Unfortunately, flush_scheduled_work() does not prevent the delayed_work
> from re-scheduling itself. The delayed_work might run after the device
> has been removed, and touch the already de-allocated info structure.
> This is a potential use-after-free.
>
> Fix by calling cancel_delayed_work_sync() during remove(): this ensures
> that the delayed work is properly cancelled, is no longer running, and
> is not able to re-schedule itself.
>
> This issue was detected with the help of Coccinelle.
>
> Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
> ---
> drivers/rtc/rtc-88pm860x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

\
 
 \ /
  Last update: 2019-04-26 20:57    [W:0.037 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site