All of lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bus/vmbus: fix resource leak on error
@ 2019-04-17 18:45 Stephen Hemminger
  2019-04-22 12:43 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2019-04-17 18:45 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Stephen Hemminger

If secondary process attempt to mmap the resource resulted in
the wrong address, then it would leave behind the bad mmap.

Coverity issue: 337675, 337664
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/bus/vmbus/linux/vmbus_uio.c  | 4 +++-
 drivers/bus/vmbus/vmbus_common_uio.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index fb60ee126d9b..be6b677f99d0 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -283,10 +283,12 @@ vmbus_uio_map_secondary_subchan(const struct rte_vmbus_device *dev,
 	if (mapaddr == MAP_FAILED)
 		VMBUS_LOG(ERR,
 			  "mmap subchan %u in secondary failed", chan->relid);
-	else
+	else {
 		VMBUS_LOG(ERR,
 			  "mmap subchan %u in secondary address mismatch",
 			  chan->relid);
+		vmbus_unmap_resource(mapaddr, 2 * ring_size);
+	}
 	return -1;
 }
 
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index 1aa5cb2e4b92..8e476f2eaf8b 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -75,9 +75,11 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
 		if (mapaddr == MAP_FAILED)
 			VMBUS_LOG(ERR,
 				  "mmap resource %d in secondary failed", i);
-		else
+		else {
 			VMBUS_LOG(ERR,
 				  "mmap resource %d address mismatch", i);
+			vmbus_unmap_resource(mapaddr, uio_res->maps[i].size);
+		}
 
 		close(fd);
 		return -1;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] bus/vmbus: fix resource leak on error
  2019-04-17 18:45 [dpdk-dev] [PATCH] bus/vmbus: fix resource leak on error Stephen Hemminger
@ 2019-04-22 12:43 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2019-04-22 12:43 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Stephen Hemminger

17/04/2019 20:45, Stephen Hemminger:
> If secondary process attempt to mmap the resource resulted in
> the wrong address, then it would leave behind the bad mmap.
> 
> Coverity issue: 337675, 337664
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>

Fixes: 2a28a502c607 ("bus/vmbus: map ring in secondary process")

Applied, thanks




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-22 12:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17 18:45 [dpdk-dev] [PATCH] bus/vmbus: fix resource leak on error Stephen Hemminger
2019-04-22 12:43 ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.