thunderbolt: Fixes for v6.11-rc3

This includes following USB4/Thunderbolt fixes for v6.11-rc3:
 
   - Fix memory leak in debugfs sideband register access
   - Fix hang when host router NVM is upgraded and there is another host
     connected.
 
 Both have been in linux-next with no reported issues.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAma0iwIgHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKCUrg/+N6mol2K6ndU+
 fcHTWPO/IRRyJ8vqfm3EaWgazZoj493va0gulATslaSBFcbz2zNXnNm9UIWl1eJX
 1PM4R8SIhuIomkp3alAMjV08Do3XcexDtTay9xrRVLclk6lu1/cu6QbgViKQikoD
 eAHvW4iLguGqcV5v1sJFOl7io3+P15rV9F39kL8YvaKhNLL7QEoyLguz9mTdEjgc
 Yvk/AK4LShr5u71xHzEPnY20XFQmDZLPP5sWrHnluKYmLKvRTWb9pKYyi8mKxL5D
 xiu2HsaGOkeZImU/tuFMiwq4wlz1hOcffn2tPpwbGF/sp12Jk/GyudyKNHNdwqIr
 TTrzZXAJ8YyBtUhsaLGAkuREVPm2ENl94Ww0i9BNVua2RVweHLCWYZ+wdSCYhM/W
 ID53So0FO/4+lhX774blmT5+hVhDTrrh/WbjRVnl5JMLaUViCygthSOlQiaR8SPH
 hJZ5CVP/Kq4QK1EDVj6hCu1uXX8FNaPLgBbt+kjuthWg2dnROB4EFR69V6TDBJpg
 MBJBgD9BdiCNOMkdNuKqwb+h/UAq+Xda4d8Mj/Gt2b6t2/4CoDB3bhNsgjPNH4KO
 CsVF6TEE94NjurKWuruYx9pTRr0b0VlXfratV76jFB/EQJt0tVdF7WTgx6+qrbz+
 2x8FgUuJ74+IQEawXVJfPK9T8LUjcek=
 =qXlw
 -----END PGP SIGNATURE-----

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

thunderbolt: Fixes for v6.11-rc3

This includes following USB4/Thunderbolt fixes for v6.11-rc3:

  - Fix memory leak in debugfs sideband register access
  - Fix hang when host router NVM is upgraded and there is another host
    connected.

Both have been in linux-next with no reported issues.

* tag 'thunderbolt-for-v6.11-rc3' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt:
  thunderbolt: Mark XDomain as unplugged when router is removed
  thunderbolt: Fix memory leaks in {port|retimer}_sb_regs_write()
This commit is contained in:
Greg Kroah-Hartman 2024-08-13 10:22:34 +02:00
commit 2185b4b720
2 changed files with 7 additions and 4 deletions

View File

@ -323,16 +323,17 @@ static ssize_t port_sb_regs_write(struct file *file, const char __user *user_buf
if (mutex_lock_interruptible(&tb->lock)) {
ret = -ERESTARTSYS;
goto out_rpm_put;
goto out;
}
ret = sb_regs_write(port, port_sb_regs, ARRAY_SIZE(port_sb_regs),
USB4_SB_TARGET_ROUTER, 0, buf, count, ppos);
mutex_unlock(&tb->lock);
out_rpm_put:
out:
pm_runtime_mark_last_busy(&sw->dev);
pm_runtime_put_autosuspend(&sw->dev);
free_page((unsigned long)buf);
return ret < 0 ? ret : count;
}
@ -355,16 +356,17 @@ static ssize_t retimer_sb_regs_write(struct file *file,
if (mutex_lock_interruptible(&tb->lock)) {
ret = -ERESTARTSYS;
goto out_rpm_put;
goto out;
}
ret = sb_regs_write(rt->port, retimer_sb_regs, ARRAY_SIZE(retimer_sb_regs),
USB4_SB_TARGET_RETIMER, rt->index, buf, count, ppos);
mutex_unlock(&tb->lock);
out_rpm_put:
out:
pm_runtime_mark_last_busy(&rt->dev);
pm_runtime_put_autosuspend(&rt->dev);
free_page((unsigned long)buf);
return ret < 0 ? ret : count;
}

View File

@ -3392,6 +3392,7 @@ void tb_switch_remove(struct tb_switch *sw)
tb_switch_remove(port->remote->sw);
port->remote = NULL;
} else if (port->xdomain) {
port->xdomain->is_unplugged = true;
tb_xdomain_remove(port->xdomain);
port->xdomain = NULL;
}