summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-11 00:02:32 -0500
committerDavid S. Miller <davem@davemloft.net>2019-03-11 11:43:39 -0700
commitfe543b2f174f34a7a751aa08b334fe6b105c4569 (patch)
tree499aaaa1a3c2be5c7418f3d19704028032b54f7a /drivers/net
parenta623a7a1a5670c25a16881f5078072d272d96b71 (diff)
downloadlinux-fe543b2f174f34a7a751aa08b334fe6b105c4569.tar.bz2
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 <kjlu@umn.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/cavium/liquidio/lio_main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 9b7819fdc9de..fb6f813cff65 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -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;