From: Alexander Duyck Date: Tue, 3 Nov 2015 01:09:29 +0000 (-0800) Subject: ixgbe: Return error on failure to allocate mac_table X-Git-Tag: Ubuntu-snapdragon-4.4.0-1029.32~4491 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=31bd632e735b6bb42228390374d81327567d6c12;p=mirror_ubuntu-zesty-kernel.git ixgbe: Return error on failure to allocate mac_table 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 Tested-by: Phil Schmitt Signed-off-by: Jeff Kirsher (cherry picked from commit 530fd82a9fea5bba8e044bdf6fdf2ddc495e3807) Signed-off-by: Tim Gardner --- diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 41e3945502a3..6311fae7a3dc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -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) {