Skip to content

Commit fe543b2

Browse files
kengiterdavem330
authored andcommitted
net: liquidio: fix a NULL pointer dereference
In case octeon_alloc_soft_command fails, the fix reports the error and returns to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a623a7a commit fe543b2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/ethernet/cavium/liquidio/lio_main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,11 @@ static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
11921192
sc = (struct octeon_soft_command *)
11931193
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE,
11941194
16, 0);
1195+
if (!sc) {
1196+
netif_info(lio, rx_err, lio->netdev,
1197+
"Failed to allocate octeon_soft_command\n");
1198+
return;
1199+
}
11951200

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

0 commit comments

Comments
 (0)