]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
ixgbe: Return error on failure to allocate mac_table
authorAlexander Duyck <aduyck@mirantis.com>
Tue, 3 Nov 2015 01:09:29 +0000 (17:09 -0800)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 29 Feb 2016 15:56:41 +0000 (08:56 -0700)
BugLink: http://bugs.launchpad.net/bugs/1536473
Add a check to make certain mac_table was actually allocated and is not
NULL.  If it is NULL return -ENOMEM and allow the probe routine to fail
rather then causing a NULL pointer dereference further down the line.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 530fd82a9fea5bba8e044bdf6fdf2ddc495e3807)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

index 41e3945502a323e0b6ffdb4570703f77e282562b..6311fae7a3dc00afc110c96862c4bd29673b130e 100644 (file)
@@ -5381,6 +5381,8 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter)
        adapter->mac_table = kzalloc(sizeof(struct ixgbe_mac_addr) *
                                     hw->mac.num_rar_entries,
                                     GFP_ATOMIC);
+       if (!adapter->mac_table)
+               return -ENOMEM;
 
        /* Set MAC specific capability flags and exceptions */
        switch (hw->mac.type) {