[PATCH 21.11] net/ice/base: fix iteration of TLVs in Preserved Fields Area

Kevin Traynor ktraynor at redhat.com
Wed Dec 4 16:56:35 CET 2024


On 04/12/2024 14:56, Bruce Richardson wrote:
> From: Fabio Pricoco <fabio.pricoco at intel.com>
> 
> Backport of commit dcb760bf0f95 ("net/ice/base: fix iteration of TLVs in
> Preserved Fields Area"), for 21.11 release, replacing the use of
> __builtin_add_overflow with an inline function to avoid breaking
> RHEL/Centos 7.
> 
> 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: 5d0b7b5fc491 ("net/ice/base: add read PBA module function")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Fabio Pricoco <fabio.pricoco at intel.com>
> Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
> Signed-off-by: Soumyadeep Hore <soumyadeep.hore at intel.com>
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> ---
>  drivers/net/ice/base/ice_nvm.c | 43 ++++++++++++++++++++++++----------
>  1 file changed, 31 insertions(+), 12 deletions(-)
> 

Thanks Bruce - applied and pushed to 21.11 branch.



More information about the stable mailing list