Skip to content

Commit bd3110b

Browse files
Dipendra333lunn
authored andcommitted
octeontx2-pf: handle otx2_mbox_get_rsp errors in otx2_flows.c
Adding error pointer check after calling otx2_mbox_get_rsp(). Fixes: 9917060 ("octeontx2-pf: Cleanup flow rule management") Fixes: f0a1913 ("octeontx2-pf: Add support for ethtool ntuple filters") Fixes: 674b3e1 ("octeontx2-pf: Add additional checks while configuring ucast/bcast/mcast rules") Signed-off-by: Dipendra Khadka <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Andrew Lunn <[email protected]>
1 parent e26f8ea commit bd3110b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ int otx2_alloc_mcam_entries(struct otx2_nic *pfvf, u16 count)
119119

120120
rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp
121121
(&pfvf->mbox.mbox, 0, &req->hdr);
122+
if (IS_ERR(rsp))
123+
goto exit;
122124

123125
for (ent = 0; ent < rsp->count; ent++)
124126
flow_cfg->flow_ent[ent + allocated] = rsp->entry_list[ent];
@@ -197,6 +199,10 @@ int otx2_mcam_entry_init(struct otx2_nic *pfvf)
197199

198200
rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp
199201
(&pfvf->mbox.mbox, 0, &req->hdr);
202+
if (IS_ERR(rsp)) {
203+
mutex_unlock(&pfvf->mbox.lock);
204+
return PTR_ERR(rsp);
205+
}
200206

201207
if (rsp->count != req->count) {
202208
netdev_info(pfvf->netdev,
@@ -232,6 +238,10 @@ int otx2_mcam_entry_init(struct otx2_nic *pfvf)
232238

233239
frsp = (struct npc_get_field_status_rsp *)otx2_mbox_get_rsp
234240
(&pfvf->mbox.mbox, 0, &freq->hdr);
241+
if (IS_ERR(frsp)) {
242+
mutex_unlock(&pfvf->mbox.lock);
243+
return PTR_ERR(frsp);
244+
}
235245

236246
if (frsp->enable) {
237247
pfvf->flags |= OTX2_FLAG_RX_VLAN_SUPPORT;

0 commit comments

Comments
 (0)