netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr()
@ 2025-03-25  2:01 Xuanqiang Luo
  2025-03-27 10:22 ` Przemek Kitszel
  2025-04-07 14:02 ` Simon Horman
  0 siblings, 2 replies; 6+ messages in thread
From: Xuanqiang Luo @ 2025-03-25  2:01 UTC (permalink / raw)
  To: przemyslaw.kitszel, anthony.l.nguyen
  Cc: davem, edumazet, netdev, intel-wired-lan, Xuanqiang Luo,
	Xuanqiang Luo

From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>

As mentioned in the commit baeb705fd6a7 ("ice: always check VF VSI
pointer values"), we need to perform a null pointer check on the return
value of ice_get_vf_vsi() before using it.

v2: Add "iwl-net" to the subject and modify the name format.

Fixes: 6ebbe97a4881 ("ice: Add a per-VF limit on number of FDIR filters")
Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
---
 drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
index 14e3f0f89c78..53bad68e3f38 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
@@ -2092,6 +2092,12 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
 	dev = ice_pf_to_dev(pf);
 	vf_vsi = ice_get_vf_vsi(vf);
 
+	if (!vf_vsi) {
+		dev_err(dev, "Can not get FDIR vf_vsi for VF %u\n", vf->vf_id);
+		v_ret = VIRTCHNL_STATUS_ERR_PARAM;
+		goto err_exit;
+	}
+
 #define ICE_VF_MAX_FDIR_FILTERS	128
 	if (!ice_fdir_num_avail_fltr(&pf->hw, vf_vsi) ||
 	    vf->fdir.fdir_fltr_cnt_total >= ICE_VF_MAX_FDIR_FILTERS) {
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr()
  2025-03-25  2:01 [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr() Xuanqiang Luo
@ 2025-03-27 10:22 ` Przemek Kitszel
  2025-04-08  2:15   ` luoxuanqiang
  2025-04-07 14:02 ` Simon Horman
  1 sibling, 1 reply; 6+ messages in thread
From: Przemek Kitszel @ 2025-03-27 10:22 UTC (permalink / raw)
  To: Xuanqiang Luo, anthony.l.nguyen
  Cc: davem, edumazet, netdev, intel-wired-lan, Xuanqiang Luo

On 3/25/25 03:01, Xuanqiang Luo wrote:
> From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
> 
> As mentioned in the commit baeb705fd6a7 ("ice: always check VF VSI
> pointer values"), we need to perform a null pointer check on the return
> value of ice_get_vf_vsi() before using it.
> 
> v2: Add "iwl-net" to the subject and modify the name format.
> 
> Fixes: 6ebbe97a4881 ("ice: Add a per-VF limit on number of FDIR filters")
> Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
> ---

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

(technically the changelog (v2:...) should be placed here, with 
additional "---" line afterwards; no need to resubmit just for that)

>   drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
> index 14e3f0f89c78..53bad68e3f38 100644
> --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
> +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
> @@ -2092,6 +2092,12 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
>   	dev = ice_pf_to_dev(pf);
>   	vf_vsi = ice_get_vf_vsi(vf);
>   
> +	if (!vf_vsi) {
> +		dev_err(dev, "Can not get FDIR vf_vsi for VF %u\n", vf->vf_id);
> +		v_ret = VIRTCHNL_STATUS_ERR_PARAM;
> +		goto err_exit;
> +	}
> +
>   #define ICE_VF_MAX_FDIR_FILTERS	128
>   	if (!ice_fdir_num_avail_fltr(&pf->hw, vf_vsi) ||
>   	    vf->fdir.fdir_fltr_cnt_total >= ICE_VF_MAX_FDIR_FILTERS) {

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr()
  2025-03-25  2:01 [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr() Xuanqiang Luo
  2025-03-27 10:22 ` Przemek Kitszel
@ 2025-04-07 14:02 ` Simon Horman
  2025-04-08  2:19   ` luoxuanqiang
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Horman @ 2025-04-07 14:02 UTC (permalink / raw)
  To: Xuanqiang Luo
  Cc: przemyslaw.kitszel, anthony.l.nguyen, davem, edumazet, netdev,
	intel-wired-lan, Xuanqiang Luo

On Tue, Mar 25, 2025 at 10:01:49AM +0800, Xuanqiang Luo wrote:
> From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
> 
> As mentioned in the commit baeb705fd6a7 ("ice: always check VF VSI
> pointer values"), we need to perform a null pointer check on the return
> value of ice_get_vf_vsi() before using it.
> 
> v2: Add "iwl-net" to the subject and modify the name format.
> 
> Fixes: 6ebbe97a4881 ("ice: Add a per-VF limit on number of FDIR filters")
> Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>

Reviewed-by: Simon Horman <horms@kernel.org>

> ---
>  drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
> index 14e3f0f89c78..53bad68e3f38 100644
> --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
> +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
> @@ -2092,6 +2092,12 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
>  	dev = ice_pf_to_dev(pf);
>  	vf_vsi = ice_get_vf_vsi(vf);
>  

nit, but not need to repost because of this: it's seems nicer
not to have not to have a blank line here. And instead, if one is
really wanted, put it above the ice_get_vf_vsi() line.

> +	if (!vf_vsi) {
> +		dev_err(dev, "Can not get FDIR vf_vsi for VF %u\n", vf->vf_id);
> +		v_ret = VIRTCHNL_STATUS_ERR_PARAM;
> +		goto err_exit;
> +	}
> +
>  #define ICE_VF_MAX_FDIR_FILTERS	128
>  	if (!ice_fdir_num_avail_fltr(&pf->hw, vf_vsi) ||
>  	    vf->fdir.fdir_fltr_cnt_total >= ICE_VF_MAX_FDIR_FILTERS) {
> -- 
> 2.27.0
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr()
  2025-03-27 10:22 ` Przemek Kitszel
@ 2025-04-08  2:15   ` luoxuanqiang
  0 siblings, 0 replies; 6+ messages in thread
From: luoxuanqiang @ 2025-04-08  2:15 UTC (permalink / raw)
  To: Przemek Kitszel, anthony.l.nguyen
  Cc: davem, edumazet, netdev, intel-wired-lan, Xuanqiang Luo


在 2025/3/27 18:22, Przemek Kitszel 写道:
> On 3/25/25 03:01, Xuanqiang Luo wrote:
>> From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
>>
>> As mentioned in the commit baeb705fd6a7 ("ice: always check VF VSI
>> pointer values"), we need to perform a null pointer check on the return
>> value of ice_get_vf_vsi() before using it.
>>
>> v2: Add "iwl-net" to the subject and modify the name format.
>>
>> Fixes: 6ebbe97a4881 ("ice: Add a per-VF limit on number of FDIR 
>> filters")
>> Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
>> ---
>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>
> (technically the changelog (v2:...) should be placed here, with 
> additional "---" line afterwards; no need to resubmit just for that)
>
Thank you for your guidance. I'll keep this in mind. :) BRs! Xuanqiang

>> drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c 
>> b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
>> index 14e3f0f89c78..53bad68e3f38 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
>> @@ -2092,6 +2092,12 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 
>> *msg)
>>       dev = ice_pf_to_dev(pf);
>>       vf_vsi = ice_get_vf_vsi(vf);
>>   +    if (!vf_vsi) {
>> +        dev_err(dev, "Can not get FDIR vf_vsi for VF %u\n", vf->vf_id);
>> +        v_ret = VIRTCHNL_STATUS_ERR_PARAM;
>> +        goto err_exit;
>> +    }
>> +
>>   #define ICE_VF_MAX_FDIR_FILTERS    128
>>       if (!ice_fdir_num_avail_fltr(&pf->hw, vf_vsi) ||
>>           vf->fdir.fdir_fltr_cnt_total >= ICE_VF_MAX_FDIR_FILTERS) {

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr()
  2025-04-07 14:02 ` Simon Horman
@ 2025-04-08  2:19   ` luoxuanqiang
  2025-04-08 10:22     ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: luoxuanqiang @ 2025-04-08  2:19 UTC (permalink / raw)
  To: Simon Horman
  Cc: przemyslaw.kitszel, anthony.l.nguyen, davem, edumazet, netdev,
	intel-wired-lan, Xuanqiang Luo


在 2025/4/7 22:02, Simon Horman 写道:
> On Tue, Mar 25, 2025 at 10:01:49AM +0800, Xuanqiang Luo wrote:
>> From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
>>
>> As mentioned in the commit baeb705fd6a7 ("ice: always check VF VSI
>> pointer values"), we need to perform a null pointer check on the return
>> value of ice_get_vf_vsi() before using it.
>>
>> v2: Add "iwl-net" to the subject and modify the name format.
>>
>> Fixes: 6ebbe97a4881 ("ice: Add a per-VF limit on number of FDIR filters")
>> Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
>> ---
>>   drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
>> index 14e3f0f89c78..53bad68e3f38 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
>> @@ -2092,6 +2092,12 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
>>   	dev = ice_pf_to_dev(pf);
>>   	vf_vsi = ice_get_vf_vsi(vf);
>>   
> nit, but not need to repost because of this: it's seems nicer
> not to have not to have a blank line here. And instead, if one is
> really wanted, put it above the ice_get_vf_vsi() line.
>
Thank you for the reminder. I will take this into consideration when
submitting other patches next time. Since vf_vsi and its judgment logic
are logically adjacent, it's better not to separate them with blank
lines.

>> +	if (!vf_vsi) {
>> +		dev_err(dev, "Can not get FDIR vf_vsi for VF %u\n", vf->vf_id);
>> +		v_ret = VIRTCHNL_STATUS_ERR_PARAM;
>> +		goto err_exit;
>> +	}
>> +
>>   #define ICE_VF_MAX_FDIR_FILTERS	128
>>   	if (!ice_fdir_num_avail_fltr(&pf->hw, vf_vsi) ||
>>   	    vf->fdir.fdir_fltr_cnt_total >= ICE_VF_MAX_FDIR_FILTERS) {
>> -- 
>> 2.27.0
>>
>>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr()
  2025-04-08  2:19   ` luoxuanqiang
@ 2025-04-08 10:22     ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-04-08 10:22 UTC (permalink / raw)
  To: luoxuanqiang
  Cc: przemyslaw.kitszel, anthony.l.nguyen, davem, edumazet, netdev,
	intel-wired-lan, Xuanqiang Luo

On Tue, Apr 08, 2025 at 10:19:39AM +0800, luoxuanqiang wrote:
> 
> 在 2025/4/7 22:02, Simon Horman 写道:
> > On Tue, Mar 25, 2025 at 10:01:49AM +0800, Xuanqiang Luo wrote:
> > > From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
> > > 
> > > As mentioned in the commit baeb705fd6a7 ("ice: always check VF VSI
> > > pointer values"), we need to perform a null pointer check on the return
> > > value of ice_get_vf_vsi() before using it.
> > > 
> > > v2: Add "iwl-net" to the subject and modify the name format.
> > > 
> > > Fixes: 6ebbe97a4881 ("ice: Add a per-VF limit on number of FDIR filters")
> > > Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
> > Reviewed-by: Simon Horman <horms@kernel.org>
> > 
> > > ---
> > >   drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c | 6 ++++++
> > >   1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
> > > index 14e3f0f89c78..53bad68e3f38 100644
> > > --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
> > > +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c
> > > @@ -2092,6 +2092,12 @@ int ice_vc_add_fdir_fltr(struct ice_vf *vf, u8 *msg)
> > >   	dev = ice_pf_to_dev(pf);
> > >   	vf_vsi = ice_get_vf_vsi(vf);
> > nit, but not need to repost because of this: it's seems nicer
> > not to have not to have a blank line here. And instead, if one is
> > really wanted, put it above the ice_get_vf_vsi() line.
> > 
> Thank you for the reminder. I will take this into consideration when
> submitting other patches next time. Since vf_vsi and its judgment logic
> are logically adjacent, it's better not to separate them with blank
> lines.

Yes, agreed. Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-08 10:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25  2:01 [PATCH iwl-net v2] ice: Check VF VSI Pointer Value in ice_vc_add_fdir_fltr() Xuanqiang Luo
2025-03-27 10:22 ` Przemek Kitszel
2025-04-08  2:15   ` luoxuanqiang
2025-04-07 14:02 ` Simon Horman
2025-04-08  2:19   ` luoxuanqiang
2025-04-08 10:22     ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).