Commit 3791b3f6 authored by Christoph Jaeger's avatar Christoph Jaeger Committed by David S. Miller

openvswitch: Fix memory leak in ovs_vport_alloc() error path

ovs_vport_alloc() bails out without freeing the memory 'vport' points to.

Picked up by Coverity - CID 1230503.

Fixes: 5cd667b0 ("openvswitch: Allow each vport to have an array of 'port_id's.")
Signed-off-by: default avatarChristoph Jaeger <cj@linux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f0094b28
...@@ -137,8 +137,10 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, ...@@ -137,8 +137,10 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
vport->ops = ops; vport->ops = ops;
INIT_HLIST_NODE(&vport->dp_hash_node); INIT_HLIST_NODE(&vport->dp_hash_node);
if (ovs_vport_set_upcall_portids(vport, parms->upcall_portids)) if (ovs_vport_set_upcall_portids(vport, parms->upcall_portids)) {
kfree(vport);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
}
vport->percpu_stats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); vport->percpu_stats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
if (!vport->percpu_stats) { if (!vport->percpu_stats) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment