summaryrefslogtreecommitdiff
path: root/drivers/isdn/mISDN/l1oip.h
diff options
context:
space:
mode:
authorDuoming Zhou <duoming@zju.edu.cn>2022-09-28 16:39:38 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-10-26 14:25:22 +0300
commit2a1d0363208528a3bacbc2c37264d60182efd482 (patch)
tree4b12ad073808060b266acec5e99db27eef3f0d72 /drivers/isdn/mISDN/l1oip.h
parentb4a5905fd2ef841cd61e969ea692c213c2e5c1f7 (diff)
downloadlinux-2a1d0363208528a3bacbc2c37264d60182efd482.tar.xz
mISDN: fix use-after-free bugs in l1oip timer handlers
[ Upstream commit 2568a7e0832ee30b0a351016d03062ab4e0e0a3f ] The l1oip_cleanup() traverses the l1oip_ilist and calls release_card() to cleanup module and stack. However, release_card() calls del_timer() to delete the timers such as keep_tl and timeout_tl. If the timer handler is running, the del_timer() will not stop it and result in UAF bugs. One of the processes is shown below: (cleanup routine) | (timer handler) release_card() | l1oip_timeout() ... | del_timer() | ... ... | kfree(hc) //FREE | | hc->timeout_on = 0 //USE Fix by calling del_timer_sync() in release_card(), which makes sure the timer handlers have finished before the resources, such as l1oip and so on, have been deallocated. What's more, the hc->workq and hc->socket_thread can kick those timers right back in. We add a bool flag to show if card is released. Then, check this flag in hc->workq and hc->socket_thread. Fixes: 3712b42d4b1b ("Add layer1 over IP support") Signed-off-by: Duoming Zhou <duoming@zju.edu.cn> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/isdn/mISDN/l1oip.h')
-rw-r--r--drivers/isdn/mISDN/l1oip.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/isdn/mISDN/l1oip.h b/drivers/isdn/mISDN/l1oip.h
index 7ea10db20e3a..48133d022812 100644
--- a/drivers/isdn/mISDN/l1oip.h
+++ b/drivers/isdn/mISDN/l1oip.h
@@ -59,6 +59,7 @@ struct l1oip {
int bundle; /* bundle channels in one frm */
int codec; /* codec to use for transmis. */
int limit; /* limit number of bchannels */
+ bool shutdown; /* if card is released */
/* timer */
struct timer_list keep_tl;