Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/ice/base: fix iteration of TLVs in Preserved Fields Area
[ upstream commit dcb760bf0f951b404bce33a1dd14906154b58c75 ] The ice_get_pfa_module_tlv() function iterates over the Preserved Fields Area to read data from the Shadow RAM, including the Part Board Assembly data, among others. If the specific TLV being requested is not found in the current NVM, the code will read past the end of the PFA, misinterpreting the last word of the PFA and the word just after the PFA as another TLV. This typically results in one extra iteration before the length check of the while loop is triggered. Correct the logic for determining the maximum PFA offset to include the extra last word. Additionally, make the driver robust against overflows by using check_add_overflow. This ensures that even if the NVM provides bogus data, the driver will not overflow, and will instead log a useful warning message. The check for whether the TLV length exceeds the PFA length is also removed, in favor of relying on the overflow warning instead. Fixes: 5d0b7b5 ("net/ice/base: add read PBA module function") Signed-off-by: Fabio Pricoco <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Signed-off-by: Soumyadeep Hore <[email protected]> Acked-by: Bruce Richardson <[email protected]>
- Loading branch information