提交 41af8b3a 编写于 作者: K Kangjie Lu 提交者: David S. Miller

net: lio_core: fix two NULL pointer dereferences

In case octeon_alloc_soft_command fails, the fix reports the
error and returns to avoid NULL pointer dereferences.
Signed-off-by: NKangjie Lu <kjlu@umn.edu>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 dd9d9f59
......@@ -1211,6 +1211,11 @@ int liquidio_change_mtu(struct net_device *netdev, int new_mtu)
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 soft command\n");
return -ENOMEM;
}
ncmd = (union octnet_cmd *)sc->virtdptr;
......@@ -1684,6 +1689,11 @@ int liquidio_set_fec(struct lio *lio, int on_off)
sc = octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE,
sizeof(struct oct_nic_seapi_resp), 0);
if (!sc) {
dev_err(&oct->pci_dev->dev,
"Failed to allocate soft command\n");
return -ENOMEM;
}
ncmd = sc->virtdptr;
resp = sc->virtrptr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册