[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190209165251.GC197782@dtor-ws>
Date: Sat, 9 Feb 2019 08:52:51 -0800
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Robin van der Gracht <robin@...tonic.nl>,
Sven Van Asbroeck <thesven73@...il.com>,
Tejun Heo <tj@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
Sebastian Reichel <sre@...nel.org>,
Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] auxdisplay: ht16k33: fix potential user-after-free on
module unload
On Sat, Feb 09, 2019 at 01:15:22AM +0100, Miguel Ojeda wrote:
> On module unload/remove, we need to ensure that work does not run
> after we have freed resources. Concretely, cancel_delayed_work()
> may return while the callback function is still running.
>
> From kernel/workqueue.c:
>
> The work callback function may still be running on return,
> unless it returns true and the work doesn't re-arm itself.
> Explicitly flush or use cancel_delayed_work_sync() to wait on it.
>
> Link: https://lore.kernel.org/lkml/20190204220952.30761-1-TheSven73@googlemail.com/
> Reported-by: Sven Van Asbroeck <thesven73@...il.com>
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
> ---
> drivers/auxdisplay/ht16k33.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c
> index a43276c76fc6..21393ec3b9a4 100644
> --- a/drivers/auxdisplay/ht16k33.c
> +++ b/drivers/auxdisplay/ht16k33.c
> @@ -509,7 +509,7 @@ static int ht16k33_remove(struct i2c_client *client)
> struct ht16k33_priv *priv = i2c_get_clientdata(client);
> struct ht16k33_fbdev *fbdev = &priv->fbdev;
>
> - cancel_delayed_work(&fbdev->work);
> + cancel_delayed_work_sync(&fbdev->work);
> unregister_framebuffer(fbdev->info);
> framebuffer_release(fbdev->info);
> free_page((unsigned long) fbdev->buffer);
> --
> 2.17.1
>
--
Dmitry
Powered by blists - more mailing lists