Skip to content

[CVE-2023-4133] cxgb4: fix use after free bugs caused by circular dependency problem - #807

Open
TrietHoang-DL wants to merge 1 commit into
Freescale:5.15-2.2.x-imxfrom
TrietHoang-DL:CVE-2023-4133/5.15-2.2.x-imx
Open

[CVE-2023-4133] cxgb4: fix use after free bugs caused by circular dependency problem#807
TrietHoang-DL wants to merge 1 commit into
Freescale:5.15-2.2.x-imxfrom
TrietHoang-DL:CVE-2023-4133/5.15-2.2.x-imx

Conversation

@TrietHoang-DL

@TrietHoang-DL TrietHoang-DL commented Aug 13, 2026

Copy link
Copy Markdown

[ Upstream commit e50b9b9 ]

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: e0f911c ("cxgb4: fetch stats for offloaded tc flower flows")

Link: https://lore.kernel.org/r/20230415081227.7463-1-duoming@zju.edu.cn

[ Upstream commit e50b9b9 ]

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: e0f911c ("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>
Signed-off-by: Triet Hoang <triet.hoang@datalogic.com>
@TrietHoang-DL TrietHoang-DL changed the title cxgb4: fix use after free bugs caused by circular dependency problem [CVE-2023-4135] cxgb4: fix use after free bugs caused by circular dependency problem Aug 13, 2026
@TrietHoang-DL TrietHoang-DL changed the title [CVE-2023-4135] cxgb4: fix use after free bugs caused by circular dependency problem [CVE-2023-4133] cxgb4: fix use after free bugs caused by circular dependency problem Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants