[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKgT0UcxqU9HBMDLKAq4-pJdAQveoGs8sQJHWoFegF3qY+RYEg@mail.gmail.com>
Date: Tue, 29 Dec 2015 15:51:50 -0800
From: Alexander Duyck <alexander.duyck@...il.com>
To: Insu Yun <wuninsu@...il.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
shannon nelson <shannon.nelson@...el.com>,
Carolyn Wyborny <carolyn.wyborny@...el.com>,
"Skidmore, Donald C" <donald.c.skidmore@...el.com>,
"Allan, Bruce W" <bruce.w.allan@...el.com>,
"Ronciak, John" <john.ronciak@...el.com>,
Mitch Williams <mitch.a.williams@...el.com>,
intel-wired-lan <intel-wired-lan@...ts.osuosl.org>,
Netdev <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
taesoo@...ech.edu, yeongjin.jang@...ech.edu, insu@...ech.edu,
changwoo@...ech.edu
Subject: Re: [PATCH] ixgbe: correctly handling failed allocation
On Tue, Dec 29, 2015 at 1:55 PM, Insu Yun <wuninsu@...il.com> wrote:
> Since kzalloc can be failed in memory pressure,
> NULL derefence could be happened.
>
> Signed-off-by: Insu Yun <wuninsu@...il.com>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index aed8d02..aa5eda0 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -5331,6 +5331,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) {
> --
> 1.9.1
That change is already present in the current net-next.
Take a look at commit 530fd82a9fea ("ixgbe: Return error on failure to
allocate mac_table").
- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists