Skip to content

Commit

Permalink
i40iw: fix null pointer dereference on a null wqe pointer
Browse files Browse the repository at this point in the history
Currently the null check for wqe is incorrect and lets a null wqe
be passed to set_64bit_val and this indexes into the null pointer
causing a null pointer dereference.  Fix this by fixing the null
pointer check to return an error if wqe is null.

Link: https://lore.kernel.org/r/20200401224921.405279-1-colin.king@canonical.com
Addresses-Coverity: ("dereference after a null check")
Fixes: 4b34e23 ("i40iw: Report correct firmware version")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Colin Ian King authored and Jason Gunthorpe committed Apr 14, 2020
1 parent 8f3d9f3 commit f70968f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/i40iw/i40iw_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ i40iw_sc_query_rdma_features(struct i40iw_sc_cqp *cqp,
u64 header;

wqe = i40iw_sc_cqp_get_next_send_wqe(cqp, scratch);
if (wqe)
if (!wqe)
return I40IW_ERR_RING_FULL;

set_64bit_val(wqe, 32, feat_mem->pa);
Expand Down

0 comments on commit f70968f

Please sign in to comment.