Skip to content

Commit 25143b6

Browse files
d-tatianindavem330
authored andcommitted
qed/qed_sriov: guard against NULL derefs from qed_iov_get_vf_info
We have to make sure that the info returned by the helper is valid before using it. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Fixes: f990c82 ("qed*: Add support for ndo_set_vf_trust") Fixes: 733def6 ("qed*: IOV link control") Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e866f29 commit 25143b6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/ethernet/qlogic/qed/qed_sriov.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4404,6 +4404,9 @@ qed_iov_configure_min_tx_rate(struct qed_dev *cdev, int vfid, u32 rate)
44044404
}
44054405

44064406
vf = qed_iov_get_vf_info(QED_LEADING_HWFN(cdev), (u16)vfid, true);
4407+
if (!vf)
4408+
return -EINVAL;
4409+
44074410
vport_id = vf->vport_id;
44084411

44094412
return qed_configure_vport_wfq(cdev, vport_id, rate);
@@ -5152,7 +5155,7 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn)
51525155

51535156
/* Validate that the VF has a configured vport */
51545157
vf = qed_iov_get_vf_info(hwfn, i, true);
5155-
if (!vf->vport_instance)
5158+
if (!vf || !vf->vport_instance)
51565159
continue;
51575160

51585161
memset(&params, 0, sizeof(params));

0 commit comments

Comments
 (0)