]> git.karo-electronics.de Git - linux-beck.git/commitdiff
liquidio: Avoid double free during soft command
authorRaghu Vatsavayi <rvatsavayi@caviumnetworks.com>
Tue, 14 Jun 2016 23:54:43 +0000 (16:54 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 Jun 2016 04:44:31 +0000 (21:44 -0700)
This patch is to resolve the double free issue by checking proper return
values from soft command.

Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Satanand Burla <satananda.burla@caviumnetworks.com>
Signed-off-by: Felix Manlunas <felix.manlunas@caviumnetworks.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/octeon_nic.c

index 245c063ed4db0f5dcf70fce926cdd6d1108b01db..1096cdb36512f3444277edc15227b41c3a95b7c7 100644 (file)
@@ -317,7 +317,7 @@ octnet_mdio45_access(struct lio *lio, int op, int loc, int *value)
 
        retval = octeon_send_soft_command(oct_dev, sc);
 
-       if (retval) {
+       if (retval == IQ_SEND_FAILED) {
                dev_err(&oct_dev->pci_dev->dev,
                        "octnet_mdio45_access instruction failed status: %x\n",
                        retval);
@@ -722,7 +722,7 @@ static int octnet_set_intrmod_cfg(void *oct, struct oct_intrmod_cfg *intr_cfg)
        sc->wait_time = 1000;
 
        retval = octeon_send_soft_command(oct_dev, sc);
-       if (retval) {
+       if (retval == IQ_SEND_FAILED) {
                octeon_free_soft_command(oct_dev, sc);
                return -EINVAL;
        }
index 655d89e8814f1d1448e7a5e79c84e65b2a50c4eb..47fba0ecdd2214aee2951665de24de54ac7bd099 100644 (file)
@@ -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,
                                     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",
                        retval);
                octeon_free_soft_command(oct, sc);
@@ -3192,7 +3192,7 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
                sc->wait_time = 1000;
 
                retval = octeon_send_soft_command(octeon_dev, sc);
-               if (retval) {
+               if (retval == IQ_SEND_FAILED) {
                        dev_err(&octeon_dev->pci_dev->dev,
                                "iq/oq config failed status: %x\n",
                                retval);
index 1a0191549cb36871737555d93c03cbeda3c0aaf3..aacabe4c54434553e1e3d3efcdc360869bbcfc29 100644 (file)
@@ -178,7 +178,7 @@ octnet_send_nic_ctrl_pkt(struct octeon_device *oct,
        }
 
        retval = octeon_send_soft_command(oct, sc);
-       if (retval) {
+       if (retval == IQ_SEND_FAILED) {
                octeon_free_soft_command(oct, sc);
                dev_err(&oct->pci_dev->dev, "%s soft command send failed status: %x\n",
                        __func__, retval);