thunderbolt: Fix for v5.10-rc7

This includes a single fix for use-after-free bug after resume from
 hibernation.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAl/E1gUgHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKBKGw/9E2/xWfTQWYzg
 LMgbF458lp4fokS7v9wEDTbqCs6EEsS9hQVayyE+RXNdpyfNos+8f/gD5cMxGUt3
 ICH/ljEJ3s2Cf748VkVN/UY9qmNaJFJ/wIJtR2w/j2h4BvBisTCpcMKdaKvTeG7J
 7Nj/oJHDcdkBrA10WH2xm/ThJQwQVZ5bt1iJaTGWGcRQXqSuSm20cUXbTe8CFpQI
 AD0iY9kLUOcvM9ihnoAwDCjqHTbpH2Zy950roL7uRXz3lqVL8yL1TxdErqY8v/E8
 aQRi1rb1CihW/bOTRRfSj+9GDk7PPfNt9t6XP4oJpbpxn+V+T9BTEVp/12lt018I
 p22QzAcYAHLgB0DP5HheR/F0UW0yYOTugbO0WsSqYREABGAq2p/DDyQ5O7DQoMCo
 7+/pfnwZiKZwpuL8nr9aqSf8jyPj8RP7FR6eeoecTBJi5pkoa+eUtMf+RxNGsXLM
 hKA5CylTroqSGkpLRuTgvnlReEckCvetUbJKBgvOz4GgQLrtZEjsI7Rl+Qpog+vq
 IpS6ULvrAuyTXUG3pG7M5+MAjmIcPAmIcsZ9dNRcQ7tPKI0bW/+HmOtn+URs9Cpy
 B6RIy9olJSPnmtPgkuxMob/KgZGoKhKQkhHBJ8oEH8H+ln4L4Tc2w8GG/1kqKIGc
 vehbGZkUn3cTeUXun8H6NSa3EIsFMEI=
 =Ejb1
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Greg Kroah-Hartman 2020-11-30 15:23:28 +01:00
commit d3f3130189

View file

@ -1976,7 +1976,9 @@ static int complete_rpm(struct device *dev, void *data)
static void remove_unplugged_switch(struct tb_switch *sw)
{
pm_runtime_get_sync(sw->dev.parent);
struct device *parent = get_device(sw->dev.parent);
pm_runtime_get_sync(parent);
/*
* Signal this and switches below for rpm_complete because
@ -1987,8 +1989,10 @@ static void remove_unplugged_switch(struct tb_switch *sw)
bus_for_each_dev(&tb_bus_type, &sw->dev, NULL, complete_rpm);
tb_switch_remove(sw);
pm_runtime_mark_last_busy(sw->dev.parent);
pm_runtime_put_autosuspend(sw->dev.parent);
pm_runtime_mark_last_busy(parent);
pm_runtime_put_autosuspend(parent);
put_device(parent);
}
static void icm_free_unplugged_children(struct tb_switch *sw)