Skip to content

Commit 69ef9bc

Browse files
committed
auxdisplay: ht16k33: fix potential user-after-free on module unload
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@gmail.com> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Sven Van Asbroeck <TheSven73@gmail.com> Acked-by: Robin van der Gracht <robin@protonic.nl> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
1 parent 8834f56 commit 69ef9bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/auxdisplay/ht16k33.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ static int ht16k33_remove(struct i2c_client *client)
509509
struct ht16k33_priv *priv = i2c_get_clientdata(client);
510510
struct ht16k33_fbdev *fbdev = &priv->fbdev;
511511

512-
cancel_delayed_work(&fbdev->work);
512+
cancel_delayed_work_sync(&fbdev->work);
513513
unregister_framebuffer(fbdev->info);
514514
framebuffer_release(fbdev->info);
515515
free_page((unsigned long) fbdev->buffer);

0 commit comments

Comments
 (0)