]> git.droids-corp.org - dpdk.git/commitdiff
devargs: fix leak on hotplug failure
authorDavid Marchand <david.marchand@redhat.com>
Thu, 14 Apr 2022 11:27:56 +0000 (13:27 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 19 May 2022 16:45:20 +0000 (18:45 +0200)
Caught by ASan, if a secondary process tried to attach a device with an
incorrect driver name, devargs was leaked.

Fixes: 64051bb1f144 ("devargs: unify scratch buffer storage")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
lib/eal/common/eal_common_dev.c

index c0ee4e442f4385a4da9eff182d07cc270cf72d59..9d913e54781536cea836c4dcc3d06b6c14fcb266 100644 (file)
@@ -180,8 +180,10 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)
        return ret;
 
 err_devarg:
-       if (rte_devargs_remove(da) != 0)
+       if (rte_devargs_remove(da) != 0) {
                rte_devargs_reset(da);
+               free(da);
+       }
        return ret;
 }