Commit ddc173a6 authored by Raghu Vatsavayi's avatar Raghu Vatsavayi Committed by David S. Miller

liquidio: Avoid double free during soft command

This patch is to resolve the double free issue by checking proper return
values from soft command.
Signed-off-by: default avatarDerek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: default avatarSatanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: default avatarFelix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: default avatarRaghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0b797c85
...@@ -317,7 +317,7 @@ octnet_mdio45_access(struct lio *lio, int op, int loc, int *value) ...@@ -317,7 +317,7 @@ octnet_mdio45_access(struct lio *lio, int op, int loc, int *value)
retval = octeon_send_soft_command(oct_dev, sc); retval = octeon_send_soft_command(oct_dev, sc);
if (retval) { if (retval == IQ_SEND_FAILED) {
dev_err(&oct_dev->pci_dev->dev, dev_err(&oct_dev->pci_dev->dev,
"octnet_mdio45_access instruction failed status: %x\n", "octnet_mdio45_access instruction failed status: %x\n",
retval); retval);
...@@ -722,7 +722,7 @@ static int octnet_set_intrmod_cfg(void *oct, struct oct_intrmod_cfg *intr_cfg) ...@@ -722,7 +722,7 @@ static int octnet_set_intrmod_cfg(void *oct, struct oct_intrmod_cfg *intr_cfg)
sc->wait_time = 1000; sc->wait_time = 1000;
retval = octeon_send_soft_command(oct_dev, sc); retval = octeon_send_soft_command(oct_dev, sc);
if (retval) { if (retval == IQ_SEND_FAILED) {
octeon_free_soft_command(oct_dev, sc); octeon_free_soft_command(oct_dev, sc);
return -EINVAL; return -EINVAL;
} }
......
...@@ -2583,7 +2583,7 @@ static inline int send_nic_timestamp_pkt(struct octeon_device *oct, ...@@ -2583,7 +2583,7 @@ static inline int send_nic_timestamp_pkt(struct octeon_device *oct,
retval = octeon_send_command(oct, sc->iq_no, ring_doorbell, &sc->cmd, retval = octeon_send_command(oct, sc->iq_no, ring_doorbell, &sc->cmd,
sc, ih->dlengsz, ndata->reqtype); sc, ih->dlengsz, ndata->reqtype);
if (retval) { if (retval == IQ_SEND_FAILED) {
dev_err(&oct->pci_dev->dev, "timestamp data packet failed status: %x\n", dev_err(&oct->pci_dev->dev, "timestamp data packet failed status: %x\n",
retval); retval);
octeon_free_soft_command(oct, sc); octeon_free_soft_command(oct, sc);
...@@ -3192,7 +3192,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) ...@@ -3192,7 +3192,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
sc->wait_time = 1000; sc->wait_time = 1000;
retval = octeon_send_soft_command(octeon_dev, sc); retval = octeon_send_soft_command(octeon_dev, sc);
if (retval) { if (retval == IQ_SEND_FAILED) {
dev_err(&octeon_dev->pci_dev->dev, dev_err(&octeon_dev->pci_dev->dev,
"iq/oq config failed status: %x\n", "iq/oq config failed status: %x\n",
retval); retval);
......
...@@ -178,7 +178,7 @@ octnet_send_nic_ctrl_pkt(struct octeon_device *oct, ...@@ -178,7 +178,7 @@ octnet_send_nic_ctrl_pkt(struct octeon_device *oct,
} }
retval = octeon_send_soft_command(oct, sc); retval = octeon_send_soft_command(oct, sc);
if (retval) { if (retval == IQ_SEND_FAILED) {
octeon_free_soft_command(oct, sc); octeon_free_soft_command(oct, sc);
dev_err(&oct->pci_dev->dev, "%s soft command send failed status: %x\n", dev_err(&oct->pci_dev->dev, "%s soft command send failed status: %x\n",
__func__, retval); __func__, retval);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment