]> git.baikalelectronics.ru Git - kernel.git/commitdiff
gve: Properly handle errors in gve_assign_qpl
authorCatherine Sullivan <csully@google.com>
Wed, 6 Oct 2021 02:42:21 +0000 (19:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Oct 2021 14:04:26 +0000 (15:04 +0100)
Ignored errors would result in crash.

Fixes: ede3fcf5ec67f ("gve: Add support for raw addressing to the rx path")
Signed-off-by: Catherine Sullivan <csully@google.com>
Signed-off-by: Jeroen de Borst <jeroendb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/google/gve/gve_rx.c

index bb8261368250293a873565cd69da3838cc358c8c..94941d4e47449244a3c4f5fe2c8248cab24300ec 100644 (file)
@@ -104,8 +104,14 @@ static int gve_prefill_rx_pages(struct gve_rx_ring *rx)
        if (!rx->data.page_info)
                return -ENOMEM;
 
-       if (!rx->data.raw_addressing)
+       if (!rx->data.raw_addressing) {
                rx->data.qpl = gve_assign_rx_qpl(priv);
+               if (!rx->data.qpl) {
+                       kvfree(rx->data.page_info);
+                       rx->data.page_info = NULL;
+                       return -ENOMEM;
+               }
+       }
        for (i = 0; i < slots; i++) {
                if (!rx->data.raw_addressing) {
                        struct page *page = rx->data.qpl->pages[i];