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: v4.1.12-92~126^2~183 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5e2a88cec6c0a2c4355c51d921de02bcbf3fac7a;p=users%2Fjedix%2Flinux-maple.git ixgbe: Return error on failure to allocate mac_table 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 Tested-by: Phil Schmitt Signed-off-by: Jeff Kirsher (cherry picked from commit 530fd82a9fea5bba8e044bdf6fdf2ddc495e3807) Signed-off-by: Brian Maly --- diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index c8570990bdd1..1a632e9cb67e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -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) {