Skip to content

Commit

Permalink
net: liquidio: fix a NULL pointer dereference
Browse files Browse the repository at this point in the history
In case octeon_alloc_soft_command fails, the fix reports the
error and returns to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Kangjie Lu authored and David S. Miller committed Mar 11, 2019
1 parent a623a7a commit fe543b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/cavium/liquidio/lio_main.c
Original file line number Diff line number Diff line change
@@ -1192,6 +1192,11 @@ static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
sc = (struct octeon_soft_command *)
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE,
16, 0);
if (!sc) {
netif_info(lio, rx_err, lio->netdev,
"Failed to allocate octeon_soft_command\n");
return;
}

ncmd = (union octnet_cmd *)sc->virtdptr;

0 comments on commit fe543b2

Please sign in to comment.