All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qed/qed_sriov: avoid a possible NULL deref in configure_min_tx_rate
@ 2023-03-15 19:48 Daniil Tatianin
  2023-03-16 10:12 ` Michal Swiatkowski
  0 siblings, 1 reply; 2+ messages in thread
From: Daniil Tatianin @ 2023-03-15 19:48 UTC (permalink / raw)
  To: Ariel Elior
  Cc: Daniil Tatianin, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Yuval Mintz, netdev, linux-kernel

We have to make sure that the info returned by qed_iov_get_vf_info is
valid before using it.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.

Fixes: 733def6a04bf ("qed*: IOV link control")
Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
---
 drivers/net/ethernet/qlogic/qed/qed_sriov.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_sriov.c b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
index 2bf18748581d..cd43f1b23eb1 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_sriov.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_sriov.c
@@ -4404,6 +4404,9 @@ qed_iov_configure_min_tx_rate(struct qed_dev *cdev, int vfid, u32 rate)
 	}
 
 	vf = qed_iov_get_vf_info(QED_LEADING_HWFN(cdev), (u16)vfid, true);
+	if (!vf)
+		return -EINVAL;
+
 	vport_id = vf->vport_id;
 
 	return qed_configure_vport_wfq(cdev, vport_id, rate);
-- 
2.25.1


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

end of thread, other threads:[~2023-03-16 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 19:48 [PATCH] qed/qed_sriov: avoid a possible NULL deref in configure_min_tx_rate Daniil Tatianin
2023-03-16 10:12 ` Michal Swiatkowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.