diff options
author | Duoming Zhou <duoming@zju.edu.cn> | 2023-04-15 16:12:27 +0800 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-04-18 09:25:53 +0200 |
commit | e50b9b9e8610d47b7c22529443e45a16b1ea3a15 (patch) | |
tree | b5d7edba926c94c8eab8e36f94ad90479512944b /lib/memweight.c | |
parent | 1a2bd3bd72e978304cdc0a7385e8048e8242225d (diff) | |
download | linux-stable-e50b9b9e8610d47b7c22529443e45a16b1ea3a15.tar.gz linux-stable-e50b9b9e8610d47b7c22529443e45a16b1ea3a15.tar.bz2 linux-stable-e50b9b9e8610d47b7c22529443e45a16b1ea3a15.zip |
cxgb4: fix use after free bugs caused by circular dependency problem
The flower_stats_timer can schedule flower_stats_work and
flower_stats_work can also arm the flower_stats_timer. The
process is shown below:
----------- timer schedules work ------------
ch_flower_stats_cb() //timer handler
schedule_work(&adap->flower_stats_work);
----------- work arms timer ------------
ch_flower_stats_handler() //workqueue callback function
mod_timer(&adap->flower_stats_timer, ...);
When the cxgb4 device is detaching, the timer and workqueue
could still be rearmed. The process is shown below:
(cleanup routine) | (timer and workqueue routine)
remove_one() |
free_some_resources() | ch_flower_stats_cb() //timer
cxgb4_cleanup_tc_flower() | schedule_work()
del_timer_sync() |
| ch_flower_stats_handler() //workqueue
| mod_timer()
cancel_work_sync() |
kfree(adapter) //FREE | ch_flower_stats_cb() //timer
| adap->flower_stats_work //USE
This patch changes del_timer_sync() to timer_shutdown_sync(),
which could prevent rearming of the timer from the workqueue.
Fixes: e0f911c81e93 ("cxgb4: fetch stats for offloaded tc flower flows")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20230415081227.7463-1-duoming@zju.edu.cn
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'lib/memweight.c')
0 files changed, 0 insertions, 0 deletions