diff options
author | Kangjie Lu <kjlu@umn.edu> | 2019-03-11 06:02:32 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-11 19:43:39 +0100 |
commit | fe543b2f174f34a7a751aa08b334fe6b105c4569 (patch) | |
tree | 499aaaa1a3c2be5c7418f3d19704028032b54f7a /drivers/net/ethernet/cavium | |
parent | y2038: fix socket.h header inclusion (diff) | |
download | linux-fe543b2f174f34a7a751aa08b334fe6b105c4569.tar.xz linux-fe543b2f174f34a7a751aa08b334fe6b105c4569.zip |
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/ethernet/cavium')
-rw-r--r-- | drivers/net/ethernet/cavium/liquidio/lio_main.c | 5 |
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; |