Skip to content

Commit b3fafea

Browse files
committed
ice: fix input validation for virtchnl BW
jira LE-4694 Rebuild_History Non-Buildable kernel-6.12.0-55.43.1.el10_0 commit-author Lukasz Czapnik <lukasz.czapnik@intel.com> commit c5be656 Add missing validation of tc and queue id values sent by a VF in ice_vc_cfg_q_bw(). Additionally fixed logged value in the warning message, where max_tx_rate was incorrectly referenced instead of min_tx_rate. Also correct error handling in this function by properly exiting when invalid configuration is detected. Fixes: 0153077 ("ice: Support VF queue rate limit and quanta size configuration") Reviewed-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com> Co-developed-by: Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com> Signed-off-by: Martyna Szapar-Mudlaw <martyna.szapar-mudlaw@linux.intel.com> Tested-by: Rafal Romanowski <rafal.romanowski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> (cherry picked from commit c5be656) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 91c97c6 commit b3fafea

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

drivers/net/ethernet/intel/ice/ice_virtchnl.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,15 +1865,33 @@ static int ice_vc_cfg_q_bw(struct ice_vf *vf, u8 *msg)
18651865

18661866
for (i = 0; i < qbw->num_queues; i++) {
18671867
if (qbw->cfg[i].shaper.peak != 0 && vf->max_tx_rate != 0 &&
1868-
qbw->cfg[i].shaper.peak > vf->max_tx_rate)
1868+
qbw->cfg[i].shaper.peak > vf->max_tx_rate) {
18691869
dev_warn(ice_pf_to_dev(vf->pf), "The maximum queue %d rate limit configuration may not take effect because the maximum TX rate for VF-%d is %d\n",
18701870
qbw->cfg[i].queue_id, vf->vf_id,
18711871
vf->max_tx_rate);
1872+
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1873+
goto err;
1874+
}
18721875
if (qbw->cfg[i].shaper.committed != 0 && vf->min_tx_rate != 0 &&
1873-
qbw->cfg[i].shaper.committed < vf->min_tx_rate)
1876+
qbw->cfg[i].shaper.committed < vf->min_tx_rate) {
18741877
dev_warn(ice_pf_to_dev(vf->pf), "The minimum queue %d rate limit configuration may not take effect because the minimum TX rate for VF-%d is %d\n",
18751878
qbw->cfg[i].queue_id, vf->vf_id,
1876-
vf->max_tx_rate);
1879+
vf->min_tx_rate);
1880+
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1881+
goto err;
1882+
}
1883+
if (qbw->cfg[i].queue_id > vf->num_vf_qs) {
1884+
dev_warn(ice_pf_to_dev(vf->pf), "VF-%d trying to configure invalid queue_id\n",
1885+
vf->vf_id);
1886+
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1887+
goto err;
1888+
}
1889+
if (qbw->cfg[i].tc >= ICE_MAX_TRAFFIC_CLASS) {
1890+
dev_warn(ice_pf_to_dev(vf->pf), "VF-%d trying to configure a traffic class higher than allowed\n",
1891+
vf->vf_id);
1892+
v_ret = VIRTCHNL_STATUS_ERR_PARAM;
1893+
goto err;
1894+
}
18771895
}
18781896

18791897
for (i = 0; i < qbw->num_queues; i++) {

0 commit comments

Comments
 (0)