diff options
author | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2019-07-04 10:40:06 +0200 |
---|---|---|
committer | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2019-07-04 10:48:05 +0200 |
commit | 8d53e9f3c6001dcb2865f6e894da5b54e1418f88 (patch) | |
tree | 63907f21c13636a987d43463c675d0727a04e327 /drivers/bus/vmbus/vmbus_channel.c | |
parent | e2bea7436061ca2e7e14bfcfdc5870f2555c3965 (diff) |
New upstream version 18.11.2upstream-18.11-stable
Change-Id: I23eb4f9179abf1f9c659891f8fddb27ee68ad26b
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Diffstat (limited to 'drivers/bus/vmbus/vmbus_channel.c')
-rw-r--r-- | drivers/bus/vmbus/vmbus_channel.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c index bd14c066..46b3ba3f 100644 --- a/drivers/bus/vmbus/vmbus_channel.c +++ b/drivers/bus/vmbus/vmbus_channel.c @@ -352,12 +352,21 @@ int vmbus_chan_create(const struct rte_vmbus_device *device, int rte_vmbus_chan_open(struct rte_vmbus_device *device, struct vmbus_channel **new_chan) { + struct mapped_vmbus_resource *uio_res; int err; + uio_res = vmbus_uio_find_resource(device); + if (!uio_res) { + VMBUS_LOG(ERR, "can't find uio resource"); + return -EINVAL; + } + err = vmbus_chan_create(device, device->relid, 0, device->monitor_id, new_chan); - if (!err) + if (!err) { device->primary = *new_chan; + uio_res->primary = *new_chan; + } return err; } @@ -396,11 +405,16 @@ void rte_vmbus_chan_close(struct vmbus_channel *chan) const struct rte_vmbus_device *device = chan->device; struct vmbus_channel *primary = device->primary; - if (chan != primary) + /* + * intentionally leak primary channel because + * secondary may still reference it + */ + if (chan != primary) { STAILQ_REMOVE(&primary->subchannel_list, chan, vmbus_channel, next); + rte_free(chan); + } - rte_free(chan); } static void vmbus_dump_ring(FILE *f, const char *id, const struct vmbus_br *br) |