From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40690 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751297AbeBRQIt (ORCPT ); Sun, 18 Feb 2018 11:08:49 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1IG7QlB112782 for ; Sun, 18 Feb 2018 11:08:49 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g72w6wm36-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 18 Feb 2018 11:08:48 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 18 Feb 2018 09:08:48 -0700 From: Thomas Falcon To: netdev@vger.kernel.org Cc: nfont@linux.vnet.ibm.com, jallen@linux.vnet.ibm.com, Thomas Falcon Subject: [PATCH net] ibmvnic: Clean RX pools only during a hard reset Date: Sun, 18 Feb 2018 10:08:40 -0600 Message-Id: <1518970121-8539-1-git-send-email-tlfalcon@linux.vnet.ibm.com> Sender: netdev-owner@vger.kernel.org List-ID: Sorry, this fixes a bug in commit d0869c0071e4. The cause of the bug is that "stale" RX buffers containing packet data are returned to the driver after device close and open. While most buffers will be returned with an error and handled by the polling routine, some buffers will be returned as containing valid data. Unfortunately, the socket buffers allocated were already freed when the device was closed, so attempts to process them result in a panic. RX pools still need to be cleaned in some cases, such as during a fatal reset. In all other cases, the socket buffers will either be freed in the polling routine or processed by the kernel. Fixes: d0869c0071e4 ("ibmvnic: Clean RX pool buffers during device close") Signed-off-by: Thomas Falcon --- drivers/net/ethernet/ibm/ibmvnic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 996f475..6710313 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -1179,7 +1179,9 @@ static int __ibmvnic_close(struct net_device *netdev) } } } - clean_rx_pools(adapter); + if (unlikely(adapter->resetting && + adapter->reset_reason != VNIC_RESET_NON_FATAL)) + clean_rx_pools(adapter); clean_tx_pools(adapter); adapter->state = VNIC_CLOSED; return rc; -- 2.7.5