From patchwork Sun Feb 18 16:08:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Falcon X-Patchwork-Id: 874884 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zksJ75vTwz9sWv for ; Mon, 19 Feb 2018 03:08:55 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751424AbeBRQIu (ORCPT ); Sun, 18 Feb 2018 11:08:50 -0500 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 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 18 Feb 2018 09:08:46 -0700 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1IG8iSX11534686; Sun, 18 Feb 2018 09:08:44 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DD946E045; Sun, 18 Feb 2018 09:08:44 -0700 (MST) Received: from tlfalcon-workstation.attlocal.net (unknown [9.80.200.43]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id 843D16E038; Sun, 18 Feb 2018 09:08:43 -0700 (MST) 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 X-Mailer: git-send-email 2.7.5 X-TM-AS-GCONF: 00 x-cbid: 18021816-0012-0000-0000-000015C5726D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008555; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00991581; UDB=6.00503681; IPR=6.00770927; MB=3.00019621; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-18 16:08:47 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18021816-0013-0000-0000-0000518AF99C Message-Id: <1518970121-8539-1-git-send-email-tlfalcon@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-02-18_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802180217 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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;