diff mbox series

[v2,net] ice: Fix NULL pointer access, if PF doesn't support SRIOV_LAG

Message ID 20240827071602.66954-1-tbogendoerfer@suse.de (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v2,net] ice: Fix NULL pointer access, if PF doesn't support SRIOV_LAG | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 20 this patch: 20
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-27--18-00 (tests: 714)

Commit Message

Thomas Bogendoerfer Aug. 27, 2024, 7:16 a.m. UTC
For PFs, which don't support SRIOV_LAG, there is no pf->lag struct
allocated. So before accessing pf->lag a NULL pointer check is needed.

Fixes: 1e0f9881ef79 ("ice: Flesh out implementation of support for SRIOV on bonded interface")
Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
v2:
 - Added Fixes tag
v1: https://lore.kernel.org/netdev/20240826085830.28136-1-tbogendoerfer@suse.de/

 drivers/net/ethernet/intel/ice/ice_lag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jiri Pirko Aug. 27, 2024, 7:40 a.m. UTC | #1
Tue, Aug 27, 2024 at 09:16:02AM CEST, tbogendoerfer@suse.de wrote:
>For PFs, which don't support SRIOV_LAG, there is no pf->lag struct
>allocated. So before accessing pf->lag a NULL pointer check is needed.
>
>Fixes: 1e0f9881ef79 ("ice: Flesh out implementation of support for SRIOV on bonded interface")
>Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Przemek Kitszel Aug. 27, 2024, 9:52 a.m. UTC | #2
On 8/27/24 09:16, Thomas Bogendoerfer wrote:
> For PFs, which don't support SRIOV_LAG, there is no pf->lag struct
> allocated. So before accessing pf->lag a NULL pointer check is needed.
> 
> Fixes: 1e0f9881ef79 ("ice: Flesh out implementation of support for SRIOV on bonded interface")
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> ---
> v2:
>   - Added Fixes tag
> v1: https://lore.kernel.org/netdev/20240826085830.28136-1-tbogendoerfer@suse.de/

Please see my reply to v1, unfortunately sent at the same time as your
v2. The fixes tag should be different. The check that you have
introduced here repeats the check in the only caller (was not effective
though).

> 
>   drivers/net/ethernet/intel/ice/ice_lag.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
> index 1ccb572ce285..916a16a379a8 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lag.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lag.c
> @@ -704,7 +704,7 @@ void ice_lag_move_new_vf_nodes(struct ice_vf *vf)
>   	lag = pf->lag;
>   
>   	mutex_lock(&pf->lag_mutex);
> -	if (!lag->bonded)
> +	if (!lag || !lag->bonded)
>   		goto new_vf_unlock;
>   
>   	pri_port = pf->hw.port_info->lport;
Przemek Kitszel Aug. 28, 2024, 8:20 a.m. UTC | #3
On 8/27/24 11:52, Przemek Kitszel wrote:
> On 8/27/24 09:16, Thomas Bogendoerfer wrote:
>> For PFs, which don't support SRIOV_LAG, there is no pf->lag struct
>> allocated. So before accessing pf->lag a NULL pointer check is needed.
>>
>> Fixes: 1e0f9881ef79 ("ice: Flesh out implementation of support for 
>> SRIOV on bonded interface")
>> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
>> ---
>> v2:
>>   - Added Fixes tag
>> v1: 
>> https://lore.kernel.org/netdev/20240826085830.28136-1-tbogendoerfer@suse.de/
> 
> Please see my reply to v1, unfortunately sent at the same time as your
> v2. The fixes tag should be different. The check that you have
> introduced here repeats the check in the only caller (was not effective
> though).
> 
>>
>>   drivers/net/ethernet/intel/ice/ice_lag.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c 
>> b/drivers/net/ethernet/intel/ice/ice_lag.c
>> index 1ccb572ce285..916a16a379a8 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_lag.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_lag.c
>> @@ -704,7 +704,7 @@ void ice_lag_move_new_vf_nodes(struct ice_vf *vf)
>>       lag = pf->lag;
>>       mutex_lock(&pf->lag_mutex);
>> -    if (!lag->bonded)
>> +    if (!lag || !lag->bonded)
>>           goto new_vf_unlock;
>>       pri_port = pf->hw.port_info->lport;
> 
> 

thank you,
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/ethernet/intel/ice/ice_lag.c
index 1ccb572ce285..916a16a379a8 100644
--- a/drivers/net/ethernet/intel/ice/ice_lag.c
+++ b/drivers/net/ethernet/intel/ice/ice_lag.c
@@ -704,7 +704,7 @@  void ice_lag_move_new_vf_nodes(struct ice_vf *vf)
 	lag = pf->lag;
 
 	mutex_lock(&pf->lag_mutex);
-	if (!lag->bonded)
+	if (!lag || !lag->bonded)
 		goto new_vf_unlock;
 
 	pri_port = pf->hw.port_info->lport;