]> www.infradead.org Git - users/jedix/linux-maple.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 13:35:13 +0000 (14:35 +0100)
commit69da13295e181768bec2cf3e2e86d0b1f1243506
tree82379a50c65a0c99902a35638ee6966ac6c469c9
parent0946b9263eaacdec2d77f53f99e31aed6f9e9644
auxdisplay: ht16k33: fix potential user-after-free on module unload

[ Upstream commit 69ef9bc54715fb1cb7786ada15774e469e822209 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/auxdisplay/ht16k33.c