diff options
author | Madalin Bucur <madalin.bucur@nxp.com> | 2017-09-01 02:24:45 (GMT) |
---|---|---|
committer | Xie Xiaobo <xiaobo.xie@nxp.com> | 2017-09-25 07:25:47 (GMT) |
commit | 1b07152d2aa53f20b1882158d15f7980f57cb384 (patch) | |
tree | 36ef1ad818adf358bd93b83967c97b60b908a2a1 | |
parent | 59043b188dd2813d8422de372869811bca1237b7 (diff) | |
download | linux-1b07152d2aa53f20b1882158d15f7980f57cb384.tar.xz |
sdk_dpaa: avoid crashing on OOM
Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
-rw-r--r-- | drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c index 6d668f2..4156c0e 100644 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c @@ -100,8 +100,12 @@ static int _dpa_bp_add_8_bufs(const struct dpa_bp *dpa_bp) * an entire cacheline for performance reasons. */ #ifndef CONFIG_PPC - if (unlikely(dpaa_errata_a010022)) - new_buf = page_address(alloc_page(GFP_ATOMIC)); + if (unlikely(dpaa_errata_a010022)) { + struct page *new_page = alloc_page(GFP_ATOMIC); + if (unlikely(!new_page)) + goto netdev_alloc_failed; + new_buf = page_address(new_page); + } else #endif new_buf = netdev_alloc_frag(SMP_CACHE_BYTES + DPA_BP_RAW_SIZE); |