Skip to content

Commit d3f3130

Browse files
committed
Merge tag 'thunderbolt-for-v5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus
Mika writes: thunderbolt: Fix for v5.10-rc7 This includes a single fix for use-after-free bug after resume from hibernation. * tag 'thunderbolt-for-v5.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Fix use-after-free in remove_unplugged_switch()
2 parents 7cc01c4 + 600c084 commit d3f3130

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

drivers/thunderbolt/icm.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,9 @@ static int complete_rpm(struct device *dev, void *data)
19761976

19771977
static void remove_unplugged_switch(struct tb_switch *sw)
19781978
{
1979-
pm_runtime_get_sync(sw->dev.parent);
1979+
struct device *parent = get_device(sw->dev.parent);
1980+
1981+
pm_runtime_get_sync(parent);
19801982

19811983
/*
19821984
* Signal this and switches below for rpm_complete because
@@ -1987,8 +1989,10 @@ static void remove_unplugged_switch(struct tb_switch *sw)
19871989
bus_for_each_dev(&tb_bus_type, &sw->dev, NULL, complete_rpm);
19881990
tb_switch_remove(sw);
19891991

1990-
pm_runtime_mark_last_busy(sw->dev.parent);
1991-
pm_runtime_put_autosuspend(sw->dev.parent);
1992+
pm_runtime_mark_last_busy(parent);
1993+
pm_runtime_put_autosuspend(parent);
1994+
1995+
put_device(parent);
19921996
}
19931997

19941998
static void icm_free_unplugged_children(struct tb_switch *sw)

0 commit comments

Comments
 (0)