diff mbox series

devargs: backup entry when inserting duplicated item

Message ID 20210417151532.12628-1-xuemingl@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series devargs: backup entry when inserting duplicated item | expand

Checks

Context Check Description
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/github-robot success github build: passed
ci/travis-robot success travis build: passed
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Xueming Li April 17, 2021, 3:15 p.m. UTC
When insert devargs that already in list, existing one was reset and
replaced completely by new once, the entry info was lost during copy.

This patch backups entry info before copy.

Fixes: 64051bb1f144 ("devargs: unify scratch buffer storage")

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 lib/librte_eal/common/eal_common_devargs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Thomas Monjalon April 19, 2021, 4:15 p.m. UTC | #1
17/04/2021 17:15, Xueming Li:
> When insert devargs that already in list, existing one was reset and
> replaced completely by new once, the entry info was lost during copy.
> 
> This patch backups entry info before copy.
> 
> Fixes: 64051bb1f144 ("devargs: unify scratch buffer storage")
> 
Reported-by: Jim Harris <james.r.harris@intel.com>

> Signed-off-by: Xueming Li <xuemingl@nvidia.com>

Applied, thanks
diff mbox series

Patch

diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
index e40b91ea66..96e0456d20 100644
--- a/lib/librte_eal/common/eal_common_devargs.c
+++ b/lib/librte_eal/common/eal_common_devargs.c
@@ -295,6 +295,7 @@  rte_devargs_insert(struct rte_devargs **da)
 		if (strcmp(listed_da->bus->name, (*da)->bus->name) == 0 &&
 				strcmp(listed_da->name, (*da)->name) == 0) {
 			/* device already in devargs list, must be updated */
+			(*da)->next = listed_da->next;
 			rte_devargs_reset(listed_da);
 			*listed_da = **da;
 			/* replace provided devargs with found one */