]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 06:00:53 +0000 (01:00 -0500)
BugLink: https://bugs.launchpad.net/bugs/1862429
[ Upstream commit 27d461333459d282ffa4a2bdb6b215a59d493a8f ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/intel/i40e/i40e_main.c

index 2004316d9d8b46f154aefa87fe72e8bb6169837e..0d01d18c6e4884dfd2b8f0375a61d0cd9720525b 100644 (file)
@@ -7198,6 +7198,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;