linux-stable/drivers/isdn/mISDN
Duoming Zhou 2568a7e083 mISDN: fix use-after-free bugs in l1oip timer handlers
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: 3712b42d4b ("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>
2022-09-30 12:32:42 +01:00
..
clock.c
core.c mISDN: change function names to avoid conflicts 2021-12-28 12:12:04 +00:00
core.h mISDN: change function names to avoid conflicts 2021-12-28 12:12:04 +00:00
dsp.h
dsp_audio.c
dsp_biquad.h
dsp_blowfish.c
dsp_cmx.c
dsp_core.c mISDN: Use LIST_HEAD() for list_head 2021-03-30 13:34:42 -07:00
dsp_dtmf.c
dsp_ecdis.h
dsp_hwec.c
dsp_hwec.h
dsp_pipeline.c mISDN: Fix memory leak in dsp_pipeline_build() 2022-03-05 12:04:14 +00:00
dsp_tones.c
fsm.c
fsm.h
hwchannel.c
Kconfig misdn: dsp: select CONFIG_BITREVERSE 2021-01-05 15:50:36 -08:00
l1oip.h mISDN: fix use-after-free bugs in l1oip timer handlers 2022-09-30 12:32:42 +01:00
l1oip_codec.c
l1oip_core.c mISDN: fix use-after-free bugs in l1oip timer handlers 2022-09-30 12:32:42 +01:00
layer1.c mISDN: change function names to avoid conflicts 2021-12-28 12:12:04 +00:00
layer1.h
layer2.c
layer2.h
Makefile
socket.c net: remove noblock parameter from skb_recv_datagram() 2022-04-06 13:45:26 +01:00
stack.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
tei.c
timerdev.c