nvmem: layouts: onie-tlv: fix hang on unknown types
Subsystems (2)
PATCH 1/1 nvmem: layouts: onie-tlv: fix hang on unknown types
The EEPROM on my board has a vendor specific entry of type 0x41. When stumbling upon that, this driver hangs in an endless loop.
Fix it by keep inrementing the offset on unknown entries, so the loop will eventually stop.
--- drivers/nvmem/layouts/onie-tlv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvmem/layouts/onie-tlv.c +2 -1
@@ -119,7 +119,7 @@ static int onie_tlv_add_cells(struct device *dev, struct nvmem_device *nvmem, cell.name =onie_tlv_cell_name (tlv.type);if (!cell.name) -continue ; + goto next; cell.offset = hdr_len + offset +sizeof (tlv.type) +sizeof (tlv.len); cell.bytes = tlv.len;
@@ -132,6 +132,7 @@ static int onie_tlv_add_cells(struct device *dev, struct nvmem_device *nvmem,return ret; } +next: offset +=sizeof (tlv) + tlv.len; }
Signature · 1 line
2.53.0
Hi Andre,
Quoted 7 lines · Andre Heider
The EEPROM on my board has a vendor specific entry of type
0x41. When stumbling upon that, this driver hangs in an endless loop.Fix it by keep inrementing the offset on unknown entries, so the loop will eventually stop.
Signed-off-by Andre Heider <[email protected]>
Needs a fixes tag, otherwise:
Thanks,
Miquèl
PATCH v2 1/1 nvmem: layouts: onie-tlv: fix hang on unknown types
The EEPROM on my board has a vendor specific entry of type 0x41. When stumbling upon that, this driver hangs in an endless loop.
Fix it by keep incrementing the offset on unknown entries, so the loop will eventually stop.
---
Thanks for the quick review, Miquel!
Added the Fixes: tag as requested, it dates back to the initial commit.
Regards,
Andre
drivers/nvmem/layouts/onie-tlv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvmem/layouts/onie-tlv.c +2 -1
@@ -119,7 +119,7 @@ static int onie_tlv_add_cells(struct device *dev, struct nvmem_device *nvmem, cell.name =onie_tlv_cell_name (tlv.type);if (!cell.name) -continue ; + goto next; cell.offset = hdr_len + offset +sizeof (tlv.type) +sizeof (tlv.len); cell.bytes = tlv.len;
@@ -132,6 +132,7 @@ static int onie_tlv_add_cells(struct device *dev, struct nvmem_device *nvmem,return ret; } +next: offset +=sizeof (tlv) + tlv.len; }
Signature · 1 line
2.53.0
Srinivas Kandagatla
maintainerQuoted 7 lines · Andre Heider
The EEPROM on my board has a vendor specific entry of type
0x41. When stumbling upon that, this driver hangs in an endless loop.Fix it by keep incrementing the offset on unknown entries, so the loop will eventually stop.
Fixes d3c0d12f6474 ("nvmem: layouts: onie-tlv: Add new layout driver")
This needs Stable tag as well, Am applying this for now but, pl make sure that a Stable tag is added to fixes next time.
--srini
Quoted 35 lines
Signed-off-by Andre Heider <[email protected]>Reviewed-by Miquel Raynal <[email protected]>---
Thanks for the quick review, Miquel!
Added the Fixes: tag as requested, it dates back to the initial commit.
Regards,
Andredrivers/nvmem/layouts/onie-tlv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/nvmem/layouts/onie-tlv.c +2
-1@@ -119,7 +119,7 @@ static int onie_tlv_add_cells(struct device *dev, struct nvmem_device *nvmem, cell.name =onie_tlv_cell_name (tlv.type);if (!cell.name) -continue ; + goto next; cell.offset = hdr_len + offset +sizeof (tlv.type) +sizeof (tlv.len); cell.bytes = tlv.len;@@ -132,6 +132,7 @@ static int onie_tlv_add_cells(struct device *dev, struct nvmem_device *nvmem,return ret; } +next: offset +=sizeof (tlv) + tlv.len; }
Quoted 8 lines · Andre Heider
The EEPROM on my board has a vendor specific entry of type
0x41. When stumbling upon that, this driver hangs in an endless loop.Fix it by keep incrementing the offset on unknown entries, so the loop will eventually stop.
[...]
Applied, thanks!
[1/1] nvmem: layouts: onie-tlv: fix hang on unknown types
commit: 7749044c03a3af8b0f777183710487deb426b651
Best regards,
Signature · 1 line
Srinivas Kandagatla <[email protected]>