diff options
author | Christoph Jaeger <cj@linux.com> | 2014-08-12 03:27:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-13 23:04:46 -0400 |
commit | 3791b3f6fb74d265c93d493d9bbf29c1e769ceae (patch) | |
tree | eb1eac4b5160d84014501558c0deabb92fd086c6 /net/openvswitch | |
parent | f0094b28f3038936c1985be64dbe83f0e950b671 (diff) |
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: 5cd667b0a4 ("openvswitch: Allow each vport to have an array of 'port_id's.")
Signed-off-by: Christoph Jaeger <cj@linux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/openvswitch')
-rw-r--r-- | net/openvswitch/vport.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index 702fb21bfe15..6d8f2ec481d9 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c | |||
@@ -137,8 +137,10 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops, | |||
137 | vport->ops = ops; | 137 | vport->ops = ops; |
138 | INIT_HLIST_NODE(&vport->dp_hash_node); | 138 | INIT_HLIST_NODE(&vport->dp_hash_node); |
139 | 139 | ||
140 | if (ovs_vport_set_upcall_portids(vport, parms->upcall_portids)) | 140 | if (ovs_vport_set_upcall_portids(vport, parms->upcall_portids)) { |
141 | kfree(vport); | ||
141 | return ERR_PTR(-EINVAL); | 142 | return ERR_PTR(-EINVAL); |
143 | } | ||
142 | 144 | ||
143 | vport->percpu_stats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); | 145 | vport->percpu_stats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
144 | if (!vport->percpu_stats) { | 146 | if (!vport->percpu_stats) { |