Re: [PATCH v4 00/27] Thunderbolt security levels and NVM firmware upgrade

From: Christian Kellner
Date: Tue Jul 25 2017 - 05:11:14 EST


Hi Mika,


I've seen this once on Alpine Ridge LP (which you have here) where the
DROM contents of the older NVM image listed too many ports. Can you try
if the below patch helps?
You were right. Patch works fine, and I indeed see the expected warnings in
the logs:

[ 102.739663] thunderbolt 0000:03:00.0: 0: DROM has too many entries 6 (expected 5)
[ 102.739665] thunderbolt 0000:03:00.0: 0: DROM has too many entries 7 (expected 5)
[ 102.739667] thunderbolt 0000:03:00.0: 0: DROM has too many entries 8 (expected 5)
[ 102.739668] thunderbolt 0000:03:00.0: 0: DROM has too many entries 9 (expected 5)
[ 102.739669] thunderbolt 0000:03:00.0: 0: DROM has too many entries 10 (expected 5)
[ 102.739670] thunderbolt 0000:03:00.0: 0: DROM has too many entries 11 (expected 5)

Thanks a lot,
Christian

diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c
index 996c6e2..bdf7f80 100644
--- a/drivers/thunderbolt/eeprom.c
+++ b/drivers/thunderbolt/eeprom.c
@@ -333,6 +333,12 @@ static int tb_drom_parse_entry_port(struct tb_switch *sw,
int res;
enum tb_port_type type;

+ if (header->index > sw->config.max_port_number) {
+ tb_sw_warn(sw, "DROM has too many entries %u (expected %u)\n",
+ header->index, sw->config.max_port_number);
+ return 0;
+ }
+
port = &sw->ports[header->index];
port->disabled = header->port_disabled;
if (port->disabled)

Tested-by: Christian Kellner <christian@xxxxxxxxxx>