]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
i40e: prevent memory leak in i40e_setup_macvlans
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Wed, 25 Sep 2019 15:48:30 +0000 (10:48 -0500)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 25 Oct 2019 20:38:19 +0000 (13:38 -0700)
In i40e_setup_macvlans if i40e_setup_channel fails the allocated memory
for ch should be released.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_main.c

index 2e4df0bd8d37d1caef48eb00955337d3f0596fce..141575ada5889141bd6c639d6bdb0d08d2d73b75 100644 (file)
@@ -7187,6 +7187,7 @@ static int i40e_setup_macvlans(struct i40e_vsi *vsi, u16 macvlan_cnt, u16 qcnt,
                ch->num_queue_pairs = qcnt;
                if (!i40e_setup_channel(pf, vsi, ch)) {
                        ret = -EINVAL;
+                       kfree(ch);
                        goto err_free;
                }
                ch->parent_vsi = vsi;