Skip to content

Commit 2185b4b

Browse files
committed
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()
2 parents 7c626ce + e200614 commit 2185b4b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

drivers/thunderbolt/debugfs.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,17 @@ static ssize_t port_sb_regs_write(struct file *file, const char __user *user_buf
323323

324324
if (mutex_lock_interruptible(&tb->lock)) {
325325
ret = -ERESTARTSYS;
326-
goto out_rpm_put;
326+
goto out;
327327
}
328328

329329
ret = sb_regs_write(port, port_sb_regs, ARRAY_SIZE(port_sb_regs),
330330
USB4_SB_TARGET_ROUTER, 0, buf, count, ppos);
331331

332332
mutex_unlock(&tb->lock);
333-
out_rpm_put:
333+
out:
334334
pm_runtime_mark_last_busy(&sw->dev);
335335
pm_runtime_put_autosuspend(&sw->dev);
336+
free_page((unsigned long)buf);
336337

337338
return ret < 0 ? ret : count;
338339
}
@@ -355,16 +356,17 @@ static ssize_t retimer_sb_regs_write(struct file *file,
355356

356357
if (mutex_lock_interruptible(&tb->lock)) {
357358
ret = -ERESTARTSYS;
358-
goto out_rpm_put;
359+
goto out;
359360
}
360361

361362
ret = sb_regs_write(rt->port, retimer_sb_regs, ARRAY_SIZE(retimer_sb_regs),
362363
USB4_SB_TARGET_RETIMER, rt->index, buf, count, ppos);
363364

364365
mutex_unlock(&tb->lock);
365-
out_rpm_put:
366+
out:
366367
pm_runtime_mark_last_busy(&rt->dev);
367368
pm_runtime_put_autosuspend(&rt->dev);
369+
free_page((unsigned long)buf);
368370

369371
return ret < 0 ? ret : count;
370372
}

drivers/thunderbolt/switch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,6 +3392,7 @@ void tb_switch_remove(struct tb_switch *sw)
33923392
tb_switch_remove(port->remote->sw);
33933393
port->remote = NULL;
33943394
} else if (port->xdomain) {
3395+
port->xdomain->is_unplugged = true;
33953396
tb_xdomain_remove(port->xdomain);
33963397
port->xdomain = NULL;
33973398
}

0 commit comments

Comments
 (0)