* [PATCH iwl-net 0/8] i40e: virtchnl improvements
@ 2025-08-13 10:45 Przemek Kitszel
2025-08-13 10:45 ` [PATCH iwl-net 1/8] i40e: add validation for ring_len param Przemek Kitszel
` (7 more replies)
0 siblings, 8 replies; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-13 10:45 UTC (permalink / raw)
To: intel-wired-lan, Tony Nguyen
Cc: netdev, Greg KH, jeremiah.kyle, leszek.pepiak, Przemek Kitszel
Improvements hardening PF-VF communication for i40e driver.
This patchset targets several issues that can cause undefined behavior
or be exploited in some other way.
Lukasz Czapnik (8):
i40e: add validation for ring_len param
i40e: fix idx validation in i40e_validate_queue_map
i40e: fix idx validation in config queues msg
i40e: fix input validation logic for action_meta
i40e: fix validation of VF state in get resources
i40e: add max boundary check for VF filters
i40e: add mask to apply valid bits for itr_idx
i40e: improve VF MAC filters accounting
drivers/net/ethernet/intel/i40e/i40e.h | 3 +-
.../ethernet/intel/i40e/i40e_virtchnl_pf.h | 3 +-
drivers/net/ethernet/intel/i40e/i40e_main.c | 26 ++++-
.../ethernet/intel/i40e/i40e_virtchnl_pf.c | 110 ++++++++++--------
4 files changed, 90 insertions(+), 52 deletions(-)
--
2.50.0
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH iwl-net 1/8] i40e: add validation for ring_len param
2025-08-13 10:45 [PATCH iwl-net 0/8] i40e: virtchnl improvements Przemek Kitszel
@ 2025-08-13 10:45 ` Przemek Kitszel
2025-08-26 16:35 ` Simon Horman
2025-08-13 10:45 ` [PATCH iwl-net 2/8] i40e: fix idx validation in i40e_validate_queue_map Przemek Kitszel
` (6 subsequent siblings)
7 siblings, 1 reply; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-13 10:45 UTC (permalink / raw)
To: intel-wired-lan, Tony Nguyen
Cc: netdev, Greg KH, jeremiah.kyle, leszek.pepiak, Przemek Kitszel,
Lukasz Czapnik, Aleksandr Loktionov
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
The `ring_len` parameter provided by the virtual function (VF)
is assigned directly to the hardware memory context (HMC) without
any validation.
To address this, introduce an upper boundary check for both Tx and Rx
queue lengths. The maximum number of descriptors supported by the
hardware is 8k-32.
Additionally, enforce alignment constraints: Tx rings must be a multiple
of 8, and Rx rings must be a multiple of 32.
Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 9b8efdeafbcf..cb37b2ac56f1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -653,6 +653,13 @@ static int i40e_config_vsi_tx_queue(struct i40e_vf *vf, u16 vsi_id,
/* only set the required fields */
tx_ctx.base = info->dma_ring_addr / 128;
+
+ /* ring_len has to be multiple of 8 */
+ if (!IS_ALIGNED(info->ring_len, 8) ||
+ info->ring_len > I40E_MAX_NUM_DESCRIPTORS_XL710) {
+ ret = -EINVAL;
+ goto error_context;
+ }
tx_ctx.qlen = info->ring_len;
tx_ctx.rdylist = le16_to_cpu(vsi->info.qs_handle[0]);
tx_ctx.rdylist_act = 0;
@@ -716,6 +723,13 @@ static int i40e_config_vsi_rx_queue(struct i40e_vf *vf, u16 vsi_id,
/* only set the required fields */
rx_ctx.base = info->dma_ring_addr / 128;
+
+ /* ring_len has to be multiple of 32 */
+ if (!IS_ALIGNED(info->ring_len, 32) ||
+ info->ring_len > I40E_MAX_NUM_DESCRIPTORS_XL710) {
+ ret = -EINVAL;
+ goto error_param;
+ }
rx_ctx.qlen = info->ring_len;
if (info->splithdr_enabled) {
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH iwl-net 2/8] i40e: fix idx validation in i40e_validate_queue_map
2025-08-13 10:45 [PATCH iwl-net 0/8] i40e: virtchnl improvements Przemek Kitszel
2025-08-13 10:45 ` [PATCH iwl-net 1/8] i40e: add validation for ring_len param Przemek Kitszel
@ 2025-08-13 10:45 ` Przemek Kitszel
2025-08-26 16:35 ` Simon Horman
[not found] ` <PH0PR11MB5013AA7A01FEA5A0D5B172A59606A@PH0PR11MB5013.namprd11.prod.outlook.com>
2025-08-13 10:45 ` [PATCH iwl-net 3/8] i40e: fix idx validation in config queues msg Przemek Kitszel
` (5 subsequent siblings)
7 siblings, 2 replies; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-13 10:45 UTC (permalink / raw)
To: intel-wired-lan, Tony Nguyen
Cc: netdev, Greg KH, jeremiah.kyle, leszek.pepiak, Przemek Kitszel,
Lukasz Czapnik, Aleksandr Loktionov
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
Ensure idx is within range of active/initialized TCs when iterating over
vf->ch[idx] in i40e_validate_queue_map().
Fixes: c27eac48160d ("i40e: Enable ADq and create queue channel/s on VF")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index cb37b2ac56f1..1c4f86221255 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2466,8 +2466,10 @@ static int i40e_validate_queue_map(struct i40e_vf *vf, u16 vsi_id,
u16 vsi_queue_id, queue_id;
for_each_set_bit(vsi_queue_id, &queuemap, I40E_MAX_VSI_QP) {
- if (vf->adq_enabled) {
- vsi_id = vf->ch[vsi_queue_id / I40E_MAX_VF_VSI].vsi_id;
+ u16 idx = vsi_queue_id / I40E_MAX_VF_VSI;
+
+ if (vf->adq_enabled && idx < vf->num_tc) {
+ vsi_id = vf->ch[idx].vsi_id;
queue_id = (vsi_queue_id % I40E_DEFAULT_QUEUES_PER_VF);
} else {
queue_id = vsi_queue_id;
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH iwl-net 3/8] i40e: fix idx validation in config queues msg
2025-08-13 10:45 [PATCH iwl-net 0/8] i40e: virtchnl improvements Przemek Kitszel
2025-08-13 10:45 ` [PATCH iwl-net 1/8] i40e: add validation for ring_len param Przemek Kitszel
2025-08-13 10:45 ` [PATCH iwl-net 2/8] i40e: fix idx validation in i40e_validate_queue_map Przemek Kitszel
@ 2025-08-13 10:45 ` Przemek Kitszel
2025-08-26 16:35 ` Simon Horman
[not found] ` <PH0PR11MB5013D93E5E69AB35CA9BAD0F9606A@PH0PR11MB5013.namprd11.prod.outlook.com>
2025-08-13 10:45 ` [PATCH iwl-net 4/8] i40e: fix input validation logic for action_meta Przemek Kitszel
` (4 subsequent siblings)
7 siblings, 2 replies; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-13 10:45 UTC (permalink / raw)
To: intel-wired-lan, Tony Nguyen
Cc: netdev, Greg KH, jeremiah.kyle, leszek.pepiak, Przemek Kitszel,
Lukasz Czapnik, Aleksandr Loktionov
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
Ensure idx is within range of active/initialized TCs when iterating over
vf->ch[idx] in i40e_vc_config_queues_msg().
Fixes: c27eac48160d ("i40e: Enable ADq and create queue channel/s on VF")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 1c4f86221255..b6db4d78c02d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2395,7 +2395,7 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg)
}
if (vf->adq_enabled) {
- if (idx >= ARRAY_SIZE(vf->ch)) {
+ if (idx >= vf->num_tc) {
aq_ret = -ENODEV;
goto error_param;
}
@@ -2416,7 +2416,7 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg)
* to its appropriate VSIs based on TC mapping
*/
if (vf->adq_enabled) {
- if (idx >= ARRAY_SIZE(vf->ch)) {
+ if (idx >= vf->num_tc) {
aq_ret = -ENODEV;
goto error_param;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH iwl-net 4/8] i40e: fix input validation logic for action_meta
2025-08-13 10:45 [PATCH iwl-net 0/8] i40e: virtchnl improvements Przemek Kitszel
` (2 preceding siblings ...)
2025-08-13 10:45 ` [PATCH iwl-net 3/8] i40e: fix idx validation in config queues msg Przemek Kitszel
@ 2025-08-13 10:45 ` Przemek Kitszel
2025-08-26 16:35 ` Simon Horman
2025-08-13 10:45 ` [PATCH iwl-net 5/8] i40e: fix validation of VF state in get resources Przemek Kitszel
` (3 subsequent siblings)
7 siblings, 1 reply; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-13 10:45 UTC (permalink / raw)
To: intel-wired-lan, Tony Nguyen
Cc: netdev, Greg KH, jeremiah.kyle, leszek.pepiak, Przemek Kitszel,
Lukasz Czapnik, Aleksandr Loktionov
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
Fix condition to check 'greater or equal' to prevent OOB dereference.
Fixes: e284fc280473 ("i40e: Add and delete cloud filter")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index b6db4d78c02d..c85715f75435 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -3603,7 +3603,7 @@ static int i40e_validate_cloud_filter(struct i40e_vf *vf,
/* action_meta is TC number here to which the filter is applied */
if (!tc_filter->action_meta ||
- tc_filter->action_meta > vf->num_tc) {
+ tc_filter->action_meta >= vf->num_tc) {
dev_info(&pf->pdev->dev, "VF %d: Invalid TC number %u\n",
vf->vf_id, tc_filter->action_meta);
goto err;
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH iwl-net 5/8] i40e: fix validation of VF state in get resources
2025-08-13 10:45 [PATCH iwl-net 0/8] i40e: virtchnl improvements Przemek Kitszel
` (3 preceding siblings ...)
2025-08-13 10:45 ` [PATCH iwl-net 4/8] i40e: fix input validation logic for action_meta Przemek Kitszel
@ 2025-08-13 10:45 ` Przemek Kitszel
2025-08-26 16:33 ` Simon Horman
2025-08-26 16:36 ` Simon Horman
2025-08-13 10:45 ` [PATCH iwl-net 6/8] i40e: add max boundary check for VF filters Przemek Kitszel
` (2 subsequent siblings)
7 siblings, 2 replies; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-13 10:45 UTC (permalink / raw)
To: intel-wired-lan, Tony Nguyen
Cc: netdev, Greg KH, jeremiah.kyle, leszek.pepiak, Przemek Kitszel,
Lukasz Czapnik, Aleksandr Loktionov
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
VF state I40E_VF_STATE_ACTIVE is not the only state in which
VF is actually active so it should not be used to determine
if a VF is allowed to obtain resources.
Use I40E_VF_STATE_RESOURCES_LOADED that is set only in
i40e_vc_get_vf_resources_msg() and cleared during reset.
Fixes: 61125b8be85d ("i40e: Fix failed opcode appearing if handling messages from VF")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 3 ++-
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 7 ++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
index 5cf74f16f433..f558b45725c8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
@@ -41,7 +41,8 @@ enum i40e_vf_states {
I40E_VF_STATE_MC_PROMISC,
I40E_VF_STATE_UC_PROMISC,
I40E_VF_STATE_PRE_ENABLE,
- I40E_VF_STATE_RESETTING
+ I40E_VF_STATE_RESETTING,
+ I40E_VF_STATE_RESOURCES_LOADED,
};
/* VF capabilities */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index c85715f75435..5ef3dc43a8a0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1464,6 +1464,7 @@ static void i40e_trigger_vf_reset(struct i40e_vf *vf, bool flr)
* functions that may still be running at this point.
*/
clear_bit(I40E_VF_STATE_INIT, &vf->vf_states);
+ clear_bit(I40E_VF_STATE_RESOURCES_LOADED, &vf->vf_states);
/* In the case of a VFLR, the HW has already reset the VF and we
* just need to clean up, so don't hit the VFRTRIG register.
@@ -2130,7 +2131,10 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
size_t len = 0;
int ret;
- if (!i40e_sync_vf_state(vf, I40E_VF_STATE_INIT)) {
+ i40e_sync_vf_state(vf, I40E_VF_STATE_INIT);
+
+ if (!test_bit(I40E_VF_STATE_INIT, &vf->vf_states) ||
+ test_bit(I40E_VF_STATE_RESOURCES_LOADED, &vf->vf_states)) {
aq_ret = -EINVAL;
goto err;
}
@@ -2233,6 +2237,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
vf->default_lan_addr.addr);
}
set_bit(I40E_VF_STATE_ACTIVE, &vf->vf_states);
+ set_bit(I40E_VF_STATE_RESOURCES_LOADED, &vf->vf_states);
err:
/* send the response back to the VF */
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH iwl-net 6/8] i40e: add max boundary check for VF filters
2025-08-13 10:45 [PATCH iwl-net 0/8] i40e: virtchnl improvements Przemek Kitszel
` (4 preceding siblings ...)
2025-08-13 10:45 ` [PATCH iwl-net 5/8] i40e: fix validation of VF state in get resources Przemek Kitszel
@ 2025-08-13 10:45 ` Przemek Kitszel
2025-08-26 16:36 ` Simon Horman
2025-08-13 10:45 ` [PATCH iwl-net 7/8] i40e: add mask to apply valid bits for itr_idx Przemek Kitszel
2025-08-13 10:45 ` [PATCH iwl-net 8/8] i40e: improve VF MAC filters accounting Przemek Kitszel
7 siblings, 1 reply; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-13 10:45 UTC (permalink / raw)
To: intel-wired-lan, Tony Nguyen
Cc: netdev, Greg KH, jeremiah.kyle, leszek.pepiak, Przemek Kitszel,
Lukasz Czapnik, Aleksandr Loktionov
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
There is no check for max filters that VF can request. Add it.
Fixes: e284fc280473 ("i40e: Add and delete cloud filter")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 5ef3dc43a8a0..f29941c00342 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -3905,6 +3905,8 @@ static int i40e_vc_del_cloud_filter(struct i40e_vf *vf, u8 *msg)
aq_ret);
}
+#define I40E_MAX_VF_CLOUD_FILTER 0xFF00
+
/**
* i40e_vc_add_cloud_filter
* @vf: pointer to the VF info
@@ -3944,6 +3946,14 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)
goto err_out;
}
+ if (vf->num_cloud_filters >= I40E_MAX_VF_CLOUD_FILTER) {
+ dev_warn(&pf->pdev->dev,
+ "VF %d: Max number of filters reached, can't apply cloud filter\n",
+ vf->vf_id);
+ aq_ret = -ENOSPC;
+ goto err_out;
+ }
+
cfilter = kzalloc(sizeof(*cfilter), GFP_KERNEL);
if (!cfilter) {
aq_ret = -ENOMEM;
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH iwl-net 7/8] i40e: add mask to apply valid bits for itr_idx
2025-08-13 10:45 [PATCH iwl-net 0/8] i40e: virtchnl improvements Przemek Kitszel
` (5 preceding siblings ...)
2025-08-13 10:45 ` [PATCH iwl-net 6/8] i40e: add max boundary check for VF filters Przemek Kitszel
@ 2025-08-13 10:45 ` Przemek Kitszel
2025-08-26 16:34 ` Simon Horman
2025-08-13 10:45 ` [PATCH iwl-net 8/8] i40e: improve VF MAC filters accounting Przemek Kitszel
7 siblings, 1 reply; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-13 10:45 UTC (permalink / raw)
To: intel-wired-lan, Tony Nguyen
Cc: netdev, Greg KH, jeremiah.kyle, leszek.pepiak, Przemek Kitszel,
Lukasz Czapnik, Aleksandr Loktionov
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
The ITR index (itr_idx) is only 2 bits wide. When constructing the
register value for QINT_RQCTL, all fields are ORed together. Without
masking, higher bits from itr_idx may overwrite adjacent fields in the
register.
Apply I40E_QINT_RQCTL_ITR_INDX_MASK to ensure only the intended bits are
set.
Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index f29941c00342..f9b2197f0942 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -448,7 +448,7 @@ static void i40e_config_irq_link_list(struct i40e_vf *vf, u16 vsi_id,
(qtype << I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT) |
(pf_queue_id << I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT) |
BIT(I40E_QINT_RQCTL_CAUSE_ENA_SHIFT) |
- (itr_idx << I40E_QINT_RQCTL_ITR_INDX_SHIFT);
+ FIELD_PREP(I40E_QINT_RQCTL_ITR_INDX_MASK, itr_idx);
wr32(hw, reg_idx, reg);
}
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH iwl-net 8/8] i40e: improve VF MAC filters accounting
2025-08-13 10:45 [PATCH iwl-net 0/8] i40e: virtchnl improvements Przemek Kitszel
` (6 preceding siblings ...)
2025-08-13 10:45 ` [PATCH iwl-net 7/8] i40e: add mask to apply valid bits for itr_idx Przemek Kitszel
@ 2025-08-13 10:45 ` Przemek Kitszel
2025-08-26 16:36 ` Simon Horman
7 siblings, 1 reply; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-13 10:45 UTC (permalink / raw)
To: intel-wired-lan, Tony Nguyen
Cc: netdev, Greg KH, jeremiah.kyle, leszek.pepiak, Przemek Kitszel,
Lukasz Czapnik, Aleksandr Loktionov
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
When adding new VM MAC, driver checks only *active* filters in
vsi->mac_filter_hash. Each MAC, even in non-active state is using resources.
To determine number of MACs VM uses, count VSI filters in *any* state.
Add i40e_count_all_filters() to simply count all filters, and rename
i40e_count_filters() to i40e_count_active_filters() to avoid ambiguity.
Fixes: cfb1d572c986 ("i40e: Add ensurance of MacVlan resources for every trusted VF")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e.h | 3 +-
drivers/net/ethernet/intel/i40e/i40e_main.c | 26 ++++++--
.../ethernet/intel/i40e/i40e_virtchnl_pf.c | 65 ++++++++-----------
3 files changed, 50 insertions(+), 44 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 49aa4497efce..801a57a925da 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -1278,7 +1278,8 @@ struct i40e_mac_filter *i40e_add_mac_filter(struct i40e_vsi *vsi,
const u8 *macaddr);
int i40e_del_mac_filter(struct i40e_vsi *vsi, const u8 *macaddr);
bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi);
-int i40e_count_filters(struct i40e_vsi *vsi);
+int i40e_count_all_filters(struct i40e_vsi *vsi);
+int i40e_count_active_filters(struct i40e_vsi *vsi);
struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, const u8 *macaddr);
void i40e_vlan_stripping_enable(struct i40e_vsi *vsi);
static inline bool i40e_is_sw_dcb(struct i40e_pf *pf)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index b83f823e4917..9d6d892602fa 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -1243,12 +1243,30 @@ void i40e_update_stats(struct i40e_vsi *vsi)
}
/**
- * i40e_count_filters - counts VSI mac filters
+ * i40e_count_all_filters - counts VSI MAC filters
* @vsi: the VSI to be searched
*
- * Returns count of mac filters
- **/
-int i40e_count_filters(struct i40e_vsi *vsi)
+ * Return: count of MAC filters in any state.
+ */
+int i40e_count_all_filters(struct i40e_vsi *vsi)
+{
+ struct i40e_mac_filter *f;
+ struct hlist_node *h;
+ int bkt, cnt = 0;
+
+ hash_for_each_safe(vsi->mac_filter_hash, bkt, h, f, hlist)
+ cnt++;
+
+ return cnt;
+}
+
+/**
+ * i40e_count_active_filters - counts VSI MAC filters
+ * @vsi: the VSI to be searched
+ *
+ * Return: count of active MAC filters.
+ */
+int i40e_count_active_filters(struct i40e_vsi *vsi)
{
struct i40e_mac_filter *f;
struct hlist_node *h;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index f9b2197f0942..081a4526a2f0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2862,24 +2862,6 @@ static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg)
(u8 *)&stats, sizeof(stats));
}
-/**
- * i40e_can_vf_change_mac
- * @vf: pointer to the VF info
- *
- * Return true if the VF is allowed to change its MAC filters, false otherwise
- */
-static bool i40e_can_vf_change_mac(struct i40e_vf *vf)
-{
- /* If the VF MAC address has been set administratively (via the
- * ndo_set_vf_mac command), then deny permission to the VF to
- * add/delete unicast MAC addresses, unless the VF is trusted
- */
- if (vf->pf_set_mac && !vf->trusted)
- return false;
-
- return true;
-}
-
#define I40E_MAX_MACVLAN_PER_HW 3072
#define I40E_MAX_MACVLAN_PER_PF(num_ports) (I40E_MAX_MACVLAN_PER_HW / \
(num_ports))
@@ -2918,8 +2900,10 @@ static inline int i40e_check_vf_permission(struct i40e_vf *vf,
struct i40e_pf *pf = vf->pf;
struct i40e_vsi *vsi = pf->vsi[vf->lan_vsi_idx];
struct i40e_hw *hw = &pf->hw;
- int mac2add_cnt = 0;
- int i;
+ int i, mac_add_max, mac_add_cnt = 0;
+ bool vf_trusted;
+
+ vf_trusted = test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps);
for (i = 0; i < al->num_elements; i++) {
struct i40e_mac_filter *f;
@@ -2939,40 +2923,43 @@ static inline int i40e_check_vf_permission(struct i40e_vf *vf,
* The VF may request to set the MAC address filter already
* assigned to it so do not return an error in that case.
*/
- if (!i40e_can_vf_change_mac(vf) &&
- !is_multicast_ether_addr(addr) &&
- !ether_addr_equal(addr, vf->default_lan_addr.addr)) {
+ if (!vf_trusted && !is_multicast_ether_addr(addr) &&
+ vf->pf_set_mac && !ether_addr_equal(addr, vf->default_lan_addr.addr)) {
dev_err(&pf->pdev->dev,
"VF attempting to override administratively set MAC address, bring down and up the VF interface to resume normal operation\n");
return -EPERM;
}
/*count filters that really will be added*/
f = i40e_find_mac(vsi, addr);
if (!f)
- ++mac2add_cnt;
+ ++mac_add_cnt;
}
/* If this VF is not privileged, then we can't add more than a limited
- * number of addresses. Check to make sure that the additions do not
- * push us over the limit.
- */
- if (!test_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps)) {
- if ((i40e_count_filters(vsi) + mac2add_cnt) >
- I40E_VC_MAX_MAC_ADDR_PER_VF) {
- dev_err(&pf->pdev->dev,
- "Cannot add more MAC addresses, VF is not trusted, switch the VF to trusted to add more functionality\n");
- return -EPERM;
- }
- /* If this VF is trusted, it can use more resources than untrusted.
+ * number of addresses.
+ *
+ * If this VF is trusted, it can use more resources than untrusted.
* However to ensure that every trusted VF has appropriate number of
* resources, divide whole pool of resources per port and then across
* all VFs.
*/
- } else {
- if ((i40e_count_filters(vsi) + mac2add_cnt) >
- I40E_VC_MAX_MACVLAN_PER_TRUSTED_VF(pf->num_alloc_vfs,
- hw->num_ports)) {
+ if (!vf_trusted)
+ mac_add_max = I40E_VC_MAX_MAC_ADDR_PER_VF;
+ else
+ mac_add_max = I40E_VC_MAX_MACVLAN_PER_TRUSTED_VF(pf->num_alloc_vfs, hw->num_ports);
+
+ /* VF can replace all its filters in one step, in this case mac_add_max
+ * will be added as active and another mac_add_max will be in
+ * a to-be-removed state. Account for that.
+ */
+ if ((i40e_count_active_filters(vsi) + mac_add_cnt) > mac_add_max ||
+ (i40e_count_all_filters(vsi) + mac_add_cnt) > 2 * mac_add_max) {
+ if (!vf_trusted) {
+ dev_err(&pf->pdev->dev,
+ "Cannot add more MAC addresses, VF is not trusted, switch the VF to trusted to add more functionality\n");
+ return -EPERM;
+ } else {
dev_err(&pf->pdev->dev,
"Cannot add more MAC addresses, trusted VF exhausted it's resources\n");
return -EPERM;
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 5/8] i40e: fix validation of VF state in get resources
2025-08-13 10:45 ` [PATCH iwl-net 5/8] i40e: fix validation of VF state in get resources Przemek Kitszel
@ 2025-08-26 16:33 ` Simon Horman
2025-08-26 20:02 ` Przemek Kitszel
2025-08-26 16:36 ` Simon Horman
1 sibling, 1 reply; 22+ messages in thread
From: Simon Horman @ 2025-08-26 16:33 UTC (permalink / raw)
To: Przemek Kitszel
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On Wed, Aug 13, 2025 at 12:45:15PM +0200, Przemek Kitszel wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>
> VF state I40E_VF_STATE_ACTIVE is not the only state in which
> VF is actually active so it should not be used to determine
> if a VF is allowed to obtain resources.
>
> Use I40E_VF_STATE_RESOURCES_LOADED that is set only in
> i40e_vc_get_vf_resources_msg() and cleared during reset.
>
> Fixes: 61125b8be85d ("i40e: Fix failed opcode appearing if handling messages from VF")
I suspect this could be
Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
But I guess that either way is fine.
> Cc: stable@vger.kernel.org
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 7/8] i40e: add mask to apply valid bits for itr_idx
2025-08-13 10:45 ` [PATCH iwl-net 7/8] i40e: add mask to apply valid bits for itr_idx Przemek Kitszel
@ 2025-08-26 16:34 ` Simon Horman
2025-08-26 19:56 ` Przemek Kitszel
0 siblings, 1 reply; 22+ messages in thread
From: Simon Horman @ 2025-08-26 16:34 UTC (permalink / raw)
To: Przemek Kitszel
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On Wed, Aug 13, 2025 at 12:45:17PM +0200, Przemek Kitszel wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>
> The ITR index (itr_idx) is only 2 bits wide. When constructing the
> register value for QINT_RQCTL, all fields are ORed together. Without
> masking, higher bits from itr_idx may overwrite adjacent fields in the
> register.
>
> Apply I40E_QINT_RQCTL_ITR_INDX_MASK to ensure only the intended bits are
> set.
I'm all for using FIELD_PREP.
But can this actually occur?
If not, it feels more like a clean-up.
Which could be more universally applied.
And targeted at net-next (without a Fixes tag).
>
> Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
My question about the target-tree aside, this looks good to me.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 1/8] i40e: add validation for ring_len param
2025-08-13 10:45 ` [PATCH iwl-net 1/8] i40e: add validation for ring_len param Przemek Kitszel
@ 2025-08-26 16:35 ` Simon Horman
0 siblings, 0 replies; 22+ messages in thread
From: Simon Horman @ 2025-08-26 16:35 UTC (permalink / raw)
To: Przemek Kitszel
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On Wed, Aug 13, 2025 at 12:45:11PM +0200, Przemek Kitszel wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>
> The `ring_len` parameter provided by the virtual function (VF)
> is assigned directly to the hardware memory context (HMC) without
> any validation.
>
> To address this, introduce an upper boundary check for both Tx and Rx
> queue lengths. The maximum number of descriptors supported by the
> hardware is 8k-32.
> Additionally, enforce alignment constraints: Tx rings must be a multiple
> of 8, and Rx rings must be a multiple of 32.
>
> Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 2/8] i40e: fix idx validation in i40e_validate_queue_map
2025-08-13 10:45 ` [PATCH iwl-net 2/8] i40e: fix idx validation in i40e_validate_queue_map Przemek Kitszel
@ 2025-08-26 16:35 ` Simon Horman
[not found] ` <PH0PR11MB5013AA7A01FEA5A0D5B172A59606A@PH0PR11MB5013.namprd11.prod.outlook.com>
1 sibling, 0 replies; 22+ messages in thread
From: Simon Horman @ 2025-08-26 16:35 UTC (permalink / raw)
To: Przemek Kitszel
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On Wed, Aug 13, 2025 at 12:45:12PM +0200, Przemek Kitszel wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>
> Ensure idx is within range of active/initialized TCs when iterating over
> vf->ch[idx] in i40e_validate_queue_map().
>
> Fixes: c27eac48160d ("i40e: Enable ADq and create queue channel/s on VF")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 3/8] i40e: fix idx validation in config queues msg
2025-08-13 10:45 ` [PATCH iwl-net 3/8] i40e: fix idx validation in config queues msg Przemek Kitszel
@ 2025-08-26 16:35 ` Simon Horman
[not found] ` <PH0PR11MB5013D93E5E69AB35CA9BAD0F9606A@PH0PR11MB5013.namprd11.prod.outlook.com>
1 sibling, 0 replies; 22+ messages in thread
From: Simon Horman @ 2025-08-26 16:35 UTC (permalink / raw)
To: Przemek Kitszel
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On Wed, Aug 13, 2025 at 12:45:13PM +0200, Przemek Kitszel wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>
> Ensure idx is within range of active/initialized TCs when iterating over
> vf->ch[idx] in i40e_vc_config_queues_msg().
>
> Fixes: c27eac48160d ("i40e: Enable ADq and create queue channel/s on VF")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 4/8] i40e: fix input validation logic for action_meta
2025-08-13 10:45 ` [PATCH iwl-net 4/8] i40e: fix input validation logic for action_meta Przemek Kitszel
@ 2025-08-26 16:35 ` Simon Horman
0 siblings, 0 replies; 22+ messages in thread
From: Simon Horman @ 2025-08-26 16:35 UTC (permalink / raw)
To: Przemek Kitszel
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On Wed, Aug 13, 2025 at 12:45:14PM +0200, Przemek Kitszel wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>
> Fix condition to check 'greater or equal' to prevent OOB dereference.
>
> Fixes: e284fc280473 ("i40e: Add and delete cloud filter")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 5/8] i40e: fix validation of VF state in get resources
2025-08-13 10:45 ` [PATCH iwl-net 5/8] i40e: fix validation of VF state in get resources Przemek Kitszel
2025-08-26 16:33 ` Simon Horman
@ 2025-08-26 16:36 ` Simon Horman
1 sibling, 0 replies; 22+ messages in thread
From: Simon Horman @ 2025-08-26 16:36 UTC (permalink / raw)
To: Przemek Kitszel
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On Wed, Aug 13, 2025 at 12:45:15PM +0200, Przemek Kitszel wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>
> VF state I40E_VF_STATE_ACTIVE is not the only state in which
> VF is actually active so it should not be used to determine
> if a VF is allowed to obtain resources.
>
> Use I40E_VF_STATE_RESOURCES_LOADED that is set only in
> i40e_vc_get_vf_resources_msg() and cleared during reset.
>
> Fixes: 61125b8be85d ("i40e: Fix failed opcode appearing if handling messages from VF")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 6/8] i40e: add max boundary check for VF filters
2025-08-13 10:45 ` [PATCH iwl-net 6/8] i40e: add max boundary check for VF filters Przemek Kitszel
@ 2025-08-26 16:36 ` Simon Horman
0 siblings, 0 replies; 22+ messages in thread
From: Simon Horman @ 2025-08-26 16:36 UTC (permalink / raw)
To: Przemek Kitszel
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On Wed, Aug 13, 2025 at 12:45:16PM +0200, Przemek Kitszel wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>
> There is no check for max filters that VF can request. Add it.
>
> Fixes: e284fc280473 ("i40e: Add and delete cloud filter")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 8/8] i40e: improve VF MAC filters accounting
2025-08-13 10:45 ` [PATCH iwl-net 8/8] i40e: improve VF MAC filters accounting Przemek Kitszel
@ 2025-08-26 16:36 ` Simon Horman
0 siblings, 0 replies; 22+ messages in thread
From: Simon Horman @ 2025-08-26 16:36 UTC (permalink / raw)
To: Przemek Kitszel
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On Wed, Aug 13, 2025 at 12:45:18PM +0200, Przemek Kitszel wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>
> When adding new VM MAC, driver checks only *active* filters in
> vsi->mac_filter_hash. Each MAC, even in non-active state is using resources.
>
> To determine number of MACs VM uses, count VSI filters in *any* state.
>
> Add i40e_count_all_filters() to simply count all filters, and rename
> i40e_count_filters() to i40e_count_active_filters() to avoid ambiguity.
>
> Fixes: cfb1d572c986 ("i40e: Add ensurance of MacVlan resources for every trusted VF")
> Cc: stable@vger.kernel.org
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 7/8] i40e: add mask to apply valid bits for itr_idx
2025-08-26 16:34 ` Simon Horman
@ 2025-08-26 19:56 ` Przemek Kitszel
0 siblings, 0 replies; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-26 19:56 UTC (permalink / raw)
To: Simon Horman
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On 8/26/25 18:34, Simon Horman wrote:
> On Wed, Aug 13, 2025 at 12:45:17PM +0200, Przemek Kitszel wrote:
>> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>>
>> The ITR index (itr_idx) is only 2 bits wide. When constructing the
>> register value for QINT_RQCTL, all fields are ORed together. Without
>> masking, higher bits from itr_idx may overwrite adjacent fields in the
>> register.
>>
>> Apply I40E_QINT_RQCTL_ITR_INDX_MASK to ensure only the intended bits are
>> set.
>
> I'm all for using FIELD_PREP.
> But can this actually occur?
>
> If not, it feels more like a clean-up.
I don't see any other place that we validate VF-provided ::rxitr_idx and
::txitr_idx of struct virtchnl_vector_map. So it's up to rogue VF.
With that, I would like to keep this as a fix.
> Which could be more universally applied.
this is also true, we typically apply such conversions when doing other
work that is related (so this time it kind of triggers :))
> And targeted at net-next (without a Fixes tag).
>
>>
>> Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
>> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
>> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>
> My question about the target-tree aside, this looks good to me.
>
> Reviewed-by: Simon Horman <horms@kernel.org>
>
thank you for looking into this series
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH iwl-net 5/8] i40e: fix validation of VF state in get resources
2025-08-26 16:33 ` Simon Horman
@ 2025-08-26 20:02 ` Przemek Kitszel
0 siblings, 0 replies; 22+ messages in thread
From: Przemek Kitszel @ 2025-08-26 20:02 UTC (permalink / raw)
To: Simon Horman
Cc: intel-wired-lan, Tony Nguyen, netdev, Greg KH, jeremiah.kyle,
leszek.pepiak, Lukasz Czapnik, Aleksandr Loktionov
On 8/26/25 18:33, Simon Horman wrote:
> On Wed, Aug 13, 2025 at 12:45:15PM +0200, Przemek Kitszel wrote:
>> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
>>
>> VF state I40E_VF_STATE_ACTIVE is not the only state in which
>> VF is actually active so it should not be used to determine
>> if a VF is allowed to obtain resources.
>>
>> Use I40E_VF_STATE_RESOURCES_LOADED that is set only in
>> i40e_vc_get_vf_resources_msg() and cleared during reset.
>>
>> Fixes: 61125b8be85d ("i40e: Fix failed opcode appearing if handling messages from VF")
my initial conclusion was that the above commit changed behavior so it
opened up a window for the second get-resources message...
>
> I suspect this could be
>
> Fixes: 5c3c48ac6bf5 ("i40e: implement virtual device interface")
... while the original impl (your proposal to blame here), while buggy,
would error out more often
>
> But I guess that either way is fine.
that is also true, so I didn't spent too much time on this
other reasoning is "Fixes: tag should be used to point to a commit that
needs patching", and picking either one here would result in the very
same outcome (the later patch would be applied as a dependency of the
current (5/8) fix)
>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
>> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
>> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>
> Reviewed-by: Simon Horman <horms@kernel.org>
thank you again for reviewing this
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Intel-wired-lan] [PATCH iwl-net 3/8] i40e: fix idx validation in config queues msg
[not found] ` <PH0PR11MB5013D93E5E69AB35CA9BAD0F9606A@PH0PR11MB5013.namprd11.prod.outlook.com>
@ 2025-09-02 12:52 ` Kamakshi, NelloreX
0 siblings, 0 replies; 22+ messages in thread
From: Kamakshi, NelloreX @ 2025-09-02 12:52 UTC (permalink / raw)
To: intel-wired-lan@lists.osuosl.org
Cc: Nguyen, Anthony L, netdev@vger.kernel.org,
gregkh@linuxfoundation.org, Kyle, Jeremiah, Pepiak, Leszek,
Kitszel, Przemyslaw, Czapnik, Lukasz, Loktionov, Aleksandr
-----Original Message-----
From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Przemek Kitszel
Sent: Wednesday, August 13, 2025 4:15 PM
To: intel-wired-lan@lists.osuosl.org; Nguyen, Anthony L <anthony.l.nguyen@intel.com>
Cc: netdev@vger.kernel.org; Greg KH <gregkh@linuxfoundation.org>; Kyle, Jeremiah <jeremiah.kyle@intel.com>; Pepiak, Leszek <leszek.pepiak@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Czapnik, Lukasz <lukasz.czapnik@intel.com>; Loktionov, Aleksandr <aleksandr.loktionov@intel.com>
Subject: [Intel-wired-lan] [PATCH iwl-net 3/8] i40e: fix idx validation in config queues msg
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
Ensure idx is within range of active/initialized TCs when iterating over
vf->ch[idx] in i40e_vc_config_queues_msg().
Fixes: c27eac48160d ("i40e: Enable ADq and create queue channel/s on VF")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
>
Tested-by: Kamakshi Nellore <nellorex.kamakshi@intel.com > (A Contingent Worker at Intel)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Intel-wired-lan] [PATCH iwl-net 2/8] i40e: fix idx validation in i40e_validate_queue_map
[not found] ` <PH0PR11MB5013AA7A01FEA5A0D5B172A59606A@PH0PR11MB5013.namprd11.prod.outlook.com>
@ 2025-09-02 12:56 ` Kamakshi, NelloreX
0 siblings, 0 replies; 22+ messages in thread
From: Kamakshi, NelloreX @ 2025-09-02 12:56 UTC (permalink / raw)
To: intel-wired-lan@lists.osuosl.org
Cc: Nguyen, Anthony L, netdev@vger.kernel.org,
gregkh@linuxfoundation.org, Kyle, Jeremiah, Pepiak, Leszek,
Kitszel, Przemyslaw, Czapnik, Lukasz, Loktionov, Aleksandr
-----Original Message-----
From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Przemek Kitszel
Sent: Wednesday, August 13, 2025 4:15 PM
To: intel-wired-lan@lists.osuosl.org; Nguyen, Anthony L <anthony.l.nguyen@intel.com>
Cc: netdev@vger.kernel.org; Greg KH <gregkh@linuxfoundation.org>; Kyle, Jeremiah <jeremiah.kyle@intel.com>; Pepiak, Leszek <leszek.pepiak@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; Czapnik, Lukasz <lukasz.czapnik@intel.com>; Loktionov, Aleksandr <aleksandr.loktionov@intel.com>
Subject: [Intel-wired-lan] [PATCH iwl-net 2/8] i40e: fix idx validation in i40e_validate_queue_map
From: Lukasz Czapnik <lukasz.czapnik@intel.com>
Ensure idx is within range of active/initialized TCs when iterating over
vf->ch[idx] in i40e_validate_queue_map().
Fixes: c27eac48160d ("i40e: Enable ADq and create queue channel/s on VF")
Cc: stable@vger.kernel.org
Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
>
Tested-by: Kamakshi Nellore <nellorex.kamakshi@intel.com > (A Contingent Worker at Intel)
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2025-09-02 12:56 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13 10:45 [PATCH iwl-net 0/8] i40e: virtchnl improvements Przemek Kitszel
2025-08-13 10:45 ` [PATCH iwl-net 1/8] i40e: add validation for ring_len param Przemek Kitszel
2025-08-26 16:35 ` Simon Horman
2025-08-13 10:45 ` [PATCH iwl-net 2/8] i40e: fix idx validation in i40e_validate_queue_map Przemek Kitszel
2025-08-26 16:35 ` Simon Horman
[not found] ` <PH0PR11MB5013AA7A01FEA5A0D5B172A59606A@PH0PR11MB5013.namprd11.prod.outlook.com>
2025-09-02 12:56 ` [Intel-wired-lan] " Kamakshi, NelloreX
2025-08-13 10:45 ` [PATCH iwl-net 3/8] i40e: fix idx validation in config queues msg Przemek Kitszel
2025-08-26 16:35 ` Simon Horman
[not found] ` <PH0PR11MB5013D93E5E69AB35CA9BAD0F9606A@PH0PR11MB5013.namprd11.prod.outlook.com>
2025-09-02 12:52 ` [Intel-wired-lan] " Kamakshi, NelloreX
2025-08-13 10:45 ` [PATCH iwl-net 4/8] i40e: fix input validation logic for action_meta Przemek Kitszel
2025-08-26 16:35 ` Simon Horman
2025-08-13 10:45 ` [PATCH iwl-net 5/8] i40e: fix validation of VF state in get resources Przemek Kitszel
2025-08-26 16:33 ` Simon Horman
2025-08-26 20:02 ` Przemek Kitszel
2025-08-26 16:36 ` Simon Horman
2025-08-13 10:45 ` [PATCH iwl-net 6/8] i40e: add max boundary check for VF filters Przemek Kitszel
2025-08-26 16:36 ` Simon Horman
2025-08-13 10:45 ` [PATCH iwl-net 7/8] i40e: add mask to apply valid bits for itr_idx Przemek Kitszel
2025-08-26 16:34 ` Simon Horman
2025-08-26 19:56 ` Przemek Kitszel
2025-08-13 10:45 ` [PATCH iwl-net 8/8] i40e: improve VF MAC filters accounting Przemek Kitszel
2025-08-26 16:36 ` 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).