summaryrefslogtreecommitdiff
path: root/drivers/auxdisplay/ht16k33.c
diff options
context:
space:
mode:
authorMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>2019-02-09 02:38:45 +0300
committerMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>2019-02-15 21:48:39 +0300
commit69ef9bc54715fb1cb7786ada15774e469e822209 (patch)
tree175415062a9d821fd89f3966a55e19431fa6e14c /drivers/auxdisplay/ht16k33.c
parent8834f5600cf3c8db365e18a3d5cac2c2780c81e5 (diff)
downloadlinux-69ef9bc54715fb1cb7786ada15774e469e822209.tar.xz
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>
Diffstat (limited to 'drivers/auxdisplay/ht16k33.c')
-rw-r--r--drivers/auxdisplay/ht16k33.c2
1 files changed, 1 insertions, 1 deletions
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);