]> git.baikalelectronics.ru Git - kernel.git/commit
auxdisplay: ht16k33: fix potential user-after-free on module unload
authorMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Fri, 8 Feb 2019 23:38:45 +0000 (00:38 +0100)
committerMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Fri, 15 Feb 2019 18:48:39 +0000 (19:48 +0100)
commit12b10801738c528fc04282dc565fa7cc8e19fe63
tree175415062a9d821fd89f3966a55e19431fa6e14c
parentb5cbce66baf0be0c7a7b3377a02035cf3ad62d9c
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>
drivers/auxdisplay/ht16k33.c