]> www.infradead.org Git - users/jedix/linux-maple.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)
committerChuck Anderson <chuck.anderson@oracle.com>
Wed, 6 Jul 2016 23:40:24 +0000 (16:40 -0700)
Orabug: 23177316

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: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

index c8570990bdd128615bae33764ed513fa8ba61bc4..1a632e9cb67e4218654f4117998409179e3d44bc 100644 (file)
@@ -5376,6 +5376,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) {