gve: Fix error return code in gve_prefill_rx_pages()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 4 Nov 2022 06:17:36 +0000 (14:17 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Nov 2022 11:32:28 +0000 (11:32 +0000)
If alloc_page() fails in gve_prefill_rx_pages(), it should return
an error code in the error path.

Fixes: 82fd151d38d9 ("gve: Reduce alloc and copy costs in the GQ rx path")
Cc: Jeroen de Borst <jeroendb@google.com>
Cc: Catherine Sullivan <csully@google.com>
Cc: Shailend Chand <shailend@google.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/google/gve/gve_rx.c

index e2f4494c65fbe3c399eedce10cc2be6e64dcba5e..1f55137722b0442c839f042d22afe9687213f7b9 100644 (file)
@@ -150,8 +150,10 @@ static int gve_prefill_rx_pages(struct gve_rx_ring *rx)
                for (j = 0; j < rx->qpl_copy_pool_mask + 1; j++) {
                        struct page *page = alloc_page(GFP_KERNEL);
 
-                       if (!page)
+                       if (!page) {
+                               err = -ENOMEM;
                                goto alloc_err_qpl;
+                       }
 
                        rx->qpl_copy_pool[j].page = page;
                        rx->qpl_copy_pool[j].page_offset = 0;