linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thunderbolt: tb: fix use after free in tb_activate_pcie_devices
@ 2017-11-05  4:52 Gustavo A. R. Silva
  2017-11-06  9:18 ` Mika Westerberg
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-05  4:52 UTC (permalink / raw)
  To: Andreas Noever, Michael Jamet, Mika Westerberg, Yehezkel Bernat
  Cc: linux-kernel, 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")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/thunderbolt/tb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index d674e06..1424581 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] thunderbolt: tb: fix use after free in tb_activate_pcie_devices
  2017-11-05  4:52 [PATCH] thunderbolt: tb: fix use after free in tb_activate_pcie_devices Gustavo A. R. Silva
@ 2017-11-06  9:18 ` Mika Westerberg
  2017-11-06 13:16   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 3+ messages in thread
From: Mika Westerberg @ 2017-11-06  9:18 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat, linux-kernel,
	Greg Kroah-Hartman

On Sat, Nov 04, 2017 at 11:52:54PM -0500, Gustavo A. R. Silva wrote:
> 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")
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Good catch!

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

> ---
>  drivers/thunderbolt/tb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> index d674e06..1424581 100644
> --- a/drivers/thunderbolt/tb.c
> +++ b/drivers/thunderbolt/tb.c
> @@ -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);
> -- 
> 2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] thunderbolt: tb: fix use after free in tb_activate_pcie_devices
  2017-11-06  9:18 ` Mika Westerberg
@ 2017-11-06 13:16   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-06 13:16 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat, linux-kernel,
	Greg Kroah-Hartman


Quoting Mika Westerberg <mika.westerberg@linux.intel.com>:

> On Sat, Nov 04, 2017 at 11:52:54PM -0500, Gustavo A. R. Silva wrote:
>> 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")
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>
> Good catch!

Glad to help. :)

>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>

Thanks
--
Gustavo A. R. Silva

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-06 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-05  4:52 [PATCH] thunderbolt: tb: fix use after free in tb_activate_pcie_devices Gustavo A. R. Silva
2017-11-06  9:18 ` Mika Westerberg
2017-11-06 13:16   ` Gustavo A. R. Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).