Skip to content

Commit

Permalink
bus/vmbus: fix resource leak on error
Browse files Browse the repository at this point in the history
[ upstream commit 26ed007 ]

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
Fixes: 2a28a50 ("bus/vmbus: map ring in secondary process")

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
  • Loading branch information
shemminger authored and kevintraynor committed May 8, 2019
1 parent 51c1632 commit 8328079
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/bus/vmbus/linux/vmbus_uio.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 8328079

Please sign in to comment.