Merge tag 'thunderbolt-for-v6.14-rc7' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus

Mika writes:

thunderbolt: Fix for v6.14-rc7

This includes single USB4/Thunderbolt fix for v6.14-rc7:

- Fix use-after-free in resume from hibernate.

This has been in linux-next with no reported issues.

* tag 'thunderbolt-for-v6.14-rc7' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt:
thunderbolt: Prevent use-after-free in resume from hibernate

+10 -3
+8 -3
drivers/thunderbolt/tunnel.c
··· 1009 1009 */ 1010 1010 tb_tunnel_get(tunnel); 1011 1011 1012 + tunnel->dprx_started = true; 1013 + 1012 1014 if (tunnel->callback) { 1013 1015 tunnel->dprx_timeout = dprx_timeout_to_ktime(dprx_timeout); 1014 1016 queue_delayed_work(tunnel->tb->wq, &tunnel->dprx_work, 0); ··· 1023 1021 1024 1022 static void tb_dp_dprx_stop(struct tb_tunnel *tunnel) 1025 1023 { 1026 - tunnel->dprx_canceled = true; 1027 - cancel_delayed_work(&tunnel->dprx_work); 1028 - tb_tunnel_put(tunnel); 1024 + if (tunnel->dprx_started) { 1025 + tunnel->dprx_started = false; 1026 + tunnel->dprx_canceled = true; 1027 + cancel_delayed_work(&tunnel->dprx_work); 1028 + tb_tunnel_put(tunnel); 1029 + } 1029 1030 } 1030 1031 1031 1032 static int tb_dp_activate(struct tb_tunnel *tunnel, bool active)
+2
drivers/thunderbolt/tunnel.h
··· 63 63 * @allocated_down: Allocated downstream bandwidth (only for USB3) 64 64 * @bw_mode: DP bandwidth allocation mode registers can be used to 65 65 * determine consumed and allocated bandwidth 66 + * @dprx_started: DPRX negotiation was started (tb_dp_dprx_start() was called for it) 66 67 * @dprx_canceled: Was DPRX capabilities read poll canceled 67 68 * @dprx_timeout: If set DPRX capabilities read poll work will timeout after this passes 68 69 * @dprx_work: Worker that is scheduled to poll completion of DPRX capabilities read ··· 101 100 int allocated_up; 102 101 int allocated_down; 103 102 bool bw_mode; 103 + bool dprx_started; 104 104 bool dprx_canceled; 105 105 ktime_t dprx_timeout; 106 106 struct delayed_work dprx_work;