public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Sven Van Asbroeck <thesven73@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: 88pm860x: prevent use-after-free on device remove
Date: Fri, 26 Apr 2019 20:57:17 +0200	[thread overview]
Message-ID: <20190426185717.GV14604@piout.net> (raw)
In-Reply-To: <20190426183635.9477-1-TheSven73@gmail.com>

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

      reply	other threads:[~2019-04-26 18:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 18:36 [PATCH] rtc: 88pm860x: prevent use-after-free on device remove Sven Van Asbroeck
2019-04-26 18:57 ` Alexandre Belloni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190426185717.GV14604@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=thesven73@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox