Skip to contentSkip to conversation

devargs: fix leak on hotplug failure

PATCH In review David Marchand 1 participant 3 messages Apr 14, 2022 – May 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devargs: fix leak on hotplug failure

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")
---
 lib/eal/common/eal_common_dev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
lib/eal/common/eal_common_dev.c +3 -1
index c0ee4e442f..9d913e5478 100644
@@ -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;
 }
 
Signature · 1 line
2.23.0
#1 lore raw
Quoted 8 lines · David Marchand

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")

Review please?

Signature · 1 line
David Marchand
#2 lore raw
Quoted 6 lines · David Marchand
Quoted 4 lines · David Marchand

Caught by ASan, if a secondary process tried to attach a device with an incorrect driver name, devargs was leaked.

Quoted 6 lines
Quoted 4 lines
Fixes 64051bb1f144 ("devargs: unify scratch buffer storage")

Review please?

No objection, the fix has been around for one month. Applied.

Signature · 1 line
David Marchand