[dpdk-dev,8/8] net/qede: fix null pointer dereferences
Checks
Commit Message
Fix null pointer dereferences in qede_vxlan_enable() and
qede_conf_udp_dst_port()
Coverity issue: 195010, 195012, 198439
Fixes: e0947ed912f7 ("net/qede: add support for VXLAN UDP port config over VF")
Fixes: 739a5b2f2b49 ("net/qede/base: use passed ptt handler")
Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
---
drivers/net/qede/qede_ethdev.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
@@ -631,7 +631,13 @@ static void qede_set_ucast_cmn_params(struct ecore_filter_ucast *ucast)
for_each_hwfn(edev, i) {
p_hwfn = &edev->hwfns[i];
- p_ptt = IS_PF(edev) ? ecore_ptt_acquire(p_hwfn) : NULL;
+ if (IS_PF(edev)) {
+ p_ptt = ecore_ptt_acquire(p_hwfn);
+ if (!p_ptt)
+ return -EAGAIN;
+ } else {
+ p_ptt = NULL;
+ }
rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, p_ptt,
&tunn, ECORE_SPQ_MODE_CB, NULL);
if (rc != ECORE_SUCCESS) {
@@ -2258,7 +2264,13 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
tunn.vxlan_port.port = udp_port;
for_each_hwfn(edev, i) {
p_hwfn = &edev->hwfns[i];
- p_ptt = IS_PF(edev) ? ecore_ptt_acquire(p_hwfn) : NULL;
+ if (IS_PF(edev)) {
+ p_ptt = ecore_ptt_acquire(p_hwfn);
+ if (!p_ptt)
+ return -EAGAIN;
+ } else {
+ p_ptt = NULL;
+ }
rc = ecore_sp_pf_update_tunn_cfg(p_hwfn, p_ptt, &tunn,
ECORE_SPQ_MODE_CB, NULL);
if (rc != ECORE_SUCCESS) {