Re: [PATCH net] sctp: fix addr_wq_timer race in sctp_free_addr_wq()
Xin Long <[email protected]> Tue, 21 Jul 2026 18:12:35 -0400
| Newsgroups | org.kernel.vger.linux-sctp,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CADvbK_dRySbf_iC2qUt9a6A8sMHpFcwtrCtKyJzKY_wnZg8PVA@mail.gmail.com> |
On Tue, Jul 21, 2026 at 5:02=E2=80=AFPM Jakub Kicinski <[email protected]> wr= ote: > > On Fri, 10 Jul 2026 14:23:43 -0400 Xin Long wrote: > > sctp_free_addr_wq() previously removed addr_wq_timer using timer_delete= () > > while holding addr_wq_lock. However, timer_delete() does not guarantee = that > > a currently running timer handler has completed. > > > > This allows a race with sctp_addr_wq_timeout_handler(), where the handl= er > > may still run after addr_waitq has been freed, acquire addr_wq_lock, an= d > > access freed memory, leading to a use-after-free. > > > > Fix this by calling timer_shutdown_sync() before taking addr_wq_lock. = This > > guarantees that any in-flight timer handler has finished and prevents t= he > > timer from being re-armed during teardown, making subsequent cleanup sa= fe. > > This version did not apply when it was posted (IDK if it applies now) > Please rebase and repost if it's still needed? You already applied this one: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id= =3D976c19de0f22a857ba0112f39635f8fd7a257568 I think I accidently posted this one twice, sorry for the confusion. We can drop this dup one. Thanks.