ibmvnic: Check for NULL skb's in NAPI poll routine
authorThomas Falcon <tlfalcon@linux.vnet.ibm.com>
Tue, 20 Feb 2018 02:12:57 +0000 (20:12 -0600)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Feb 2018 19:31:11 +0000 (14:31 -0500)
After introduction of commit d0869c0071e4, there were some instances of
RX queue entries from a previous session (before the device was closed
and reopened) returned to the NAPI polling routine. Since the corresponding
socket buffers were freed, this resulted in a panic on reopen. Include
a check for a NULL skb here to avoid this.

Fixes: d0869c0071e4 ("ibmvnic: Clean RX pool buffers during device close")
Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c

index 996f47568f9e3ba77f50668696cbd4e0979ceaa5..1495cb99f92497075bc44c8ce115b1231a3f406c 100644 (file)
@@ -1901,6 +1901,11 @@ restart_poll:
                        dev_kfree_skb_any(rx_buff->skb);
                        remove_buff_from_pool(adapter, rx_buff);
                        continue;
+               } else if (!rx_buff->skb) {
+                       /* free the entry */
+                       next->rx_comp.first = 0;
+                       remove_buff_from_pool(adapter, rx_buff);
+                       continue;
                }
 
                length = be32_to_cpu(next->rx_comp.len);