From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45852 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932325AbeBTCNL (ORCPT ); Mon, 19 Feb 2018 21:13:11 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1K28u7p040304 for ; Mon, 19 Feb 2018 21:13:11 -0500 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g84pj3g1g-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 19 Feb 2018 21:13:10 -0500 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Feb 2018 21:13:10 -0500 From: Thomas Falcon To: netdev@vger.kernel.org Cc: davem@davemloft.net, jallen@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, Thomas Falcon Subject: [PATCH net v2] ibmvnic: Check for NULL skb's in NAPI poll routine Date: Mon, 19 Feb 2018 20:12:57 -0600 In-Reply-To: <1518970121-8539-1-git-send-email-tlfalcon@linux.vnet.ibm.com> References: <1518970121-8539-1-git-send-email-tlfalcon@linux.vnet.ibm.com> Message-Id: <1519092777-11559-1-git-send-email-tlfalcon@linux.vnet.ibm.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 --- v2: Followed David Miller's suggestion to check for a NULL socket buffer Originally sent as "ibmvnic: Clean RX pools only during a hard reset" --- drivers/net/ethernet/ibm/ibmvnic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 996f475..1495cb9 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1901,6 +1901,11 @@ static int ibmvnic_poll(struct napi_struct *napi, int budget) 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); -- 2.7.5