Skip to contentSkip to conversation

thunderbolt: tb: fix use after free in tb_activate_pcie_devices

PATCH In review Gustavo A. R. Silva 2 participants 3 messages Nov 5, 2017 – Nov 6, 2017 Thunderbolt driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thunderbolt: tb: fix use after free in tb_activate_pcie_devices

Add a ̣̣continue statement in order to avoid using a previously free'd pointer tunnel in list_add.

Addresses-Coverity-ID: 1415336

Fixes 9d3cce0b6136 ("thunderbolt: Introduce thunderbolt bus and connection manager")
---
 drivers/thunderbolt/tb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thunderbolt/tb.c +1 -0
index d674e06..1424581 100644
@@ -225,6 +225,7 @@ static void tb_activate_pcie_devices(struct tb *tb)
 			tb_port_info(up_port,
 				     "PCIe tunnel activation failed, aborting\n");
 			tb_pci_free(tunnel);
+			continue;
 		}
 
 		list_add(&tunnel->list, &tcm->tunnel_list);
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Gustavo A. R. Silva

Add a ̣̣continue statement in order to avoid using a previously free'd pointer tunnel in list_add.

Addresses-Coverity-ID: 1415336

Fixes 9d3cce0b6136 ("thunderbolt: Introduce thunderbolt bus and connection manager")

Good catch!

Greg, can you pick this to your char-misc tree? Thanks.

Quoted 18 lines
---
 drivers/thunderbolt/tb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/thunderbolt/tb.c +1 -0
index d674e06..1424581 100644
@@ -225,6 +225,7 @@ static void tb_activate_pcie_devices(struct tb *tb)
 			tb_port_info(up_port,
 				     "PCIe tunnel activation failed, aborting\n");
 			tb_pci_free(tunnel);
+			continue;
 		}
 
 		list_add(&tunnel->list, &tcm->tunnel_list);
Signature · 1 line
2.7.4
#2 lore raw

Quoting Mika Westerberg <[email protected]>:

Quoted 9 lines · Gustavo A. R. Silva
Quoted 6 lines

Add a ̣̣continue statement in order to avoid using a previously free'd pointer tunnel in list_add.

Addresses-Coverity-ID: 1415336

Fixes 9d3cce0b6136 ("thunderbolt: Introduce thunderbolt bus and connection manager")

Good catch!

Glad to help. :)

Quoted 3 lines

Thanks
--
Gustavo A. R. Silva