Skip to content

Commit e26f8ea

Browse files
Dipendra333lunn
authored andcommitted
octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_ethtool.c
Add error pointer check after calling otx2_mbox_get_rsp(). Fixes: 75f3627 ("octeontx2-pf: Support to enable/disable pause frames via ethtool") Fixes: d0cf950 ("octeontx2-pf: ethtool fec mode support") Signed-off-by: Dipendra Khadka <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Andrew Lunn <[email protected]>
1 parent 0fbc7a5 commit e26f8ea

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ static void otx2_get_pauseparam(struct net_device *netdev,
343343
if (!otx2_sync_mbox_msg(&pfvf->mbox)) {
344344
rsp = (struct cgx_pause_frm_cfg *)
345345
otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr);
346+
if (IS_ERR(rsp)) {
347+
mutex_unlock(&pfvf->mbox.lock);
348+
return;
349+
}
350+
346351
pause->rx_pause = rsp->rx_pause;
347352
pause->tx_pause = rsp->tx_pause;
348353
}
@@ -1072,6 +1077,11 @@ static int otx2_set_fecparam(struct net_device *netdev,
10721077

10731078
rsp = (struct fec_mode *)otx2_mbox_get_rsp(&pfvf->mbox.mbox,
10741079
0, &req->hdr);
1080+
if (IS_ERR(rsp)) {
1081+
err = PTR_ERR(rsp);
1082+
goto end;
1083+
}
1084+
10751085
if (rsp->fec >= 0)
10761086
pfvf->linfo.fec = rsp->fec;
10771087
else

0 commit comments

Comments
 (0)