OSDN Git Service
(root)
/
android-x86
/
kernel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dd9d9f5
)
net: lio_core: fix two NULL pointer dereferences
author
Kangjie Lu
<kjlu@umn.edu>
Mon, 11 Mar 2019 06:01:41 +0000
(
01:01
-0500)
committer
David S. Miller
<davem@davemloft.net>
Mon, 11 Mar 2019 19:29:17 +0000
(12:29 -0700)
In case octeon_alloc_soft_command fails, the fix reports the
error and returns to avoid NULL pointer dereferences.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_core.c
patch
|
blob
|
history
diff --git
a/drivers/net/ethernet/cavium/liquidio/lio_core.c
b/drivers/net/ethernet/cavium/liquidio/lio_core.c
index
e21bf37
..
1c50c10
100644
(file)
--- a/
drivers/net/ethernet/cavium/liquidio/lio_core.c
+++ b/
drivers/net/ethernet/cavium/liquidio/lio_core.c
@@
-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;