From patchwork Fri Jun 30 05:46:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 106664 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1904640qge; Thu, 29 Jun 2017 22:47:10 -0700 (PDT) X-Received: by 10.99.104.136 with SMTP id d130mr19138904pgc.236.1498801630449; Thu, 29 Jun 2017 22:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498801630; cv=none; d=google.com; s=arc-20160816; b=D4cEJhRfepHdGf0zOuP7aE3mGnOJu1ao5j6dACmxdbOkuW4uaeiSfDFGXYrz75wLcE t015kWRF0W539SXgfmzGTKKr7lLelNGz5wrN5BnHBys3CCqs3+QXnNc/k6O9ymKm/WwR VE/jCHVW29F40oBL2h3bwb6JyYAJsISfRn5sEzCYZyTrgsLii/aOvKOeBoHPc2odt1dQ x2FqZyGzIEubiVMhB7eecegw5EZYiCMEZbFcRMiinpcpaadSFz/Jl4JUGLSM6yLr9cj5 LeibNIeIMkJE3UNvcV2zzkqwlTVV7mAKKrCbLQSRtdUka8wsJhmmmvM5AKR+JkezIDsV BwWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=YKb3SKp+YykpyYGPW7DjF12C4OYgDfq9gXRJePx0N3Y=; b=ZAUtkkvaoCl5+14MLrJRCQIX5lDb1Qf5o6Am/TNT710IpEm8VjeTTNTaW8Oe7nXa46 xx5TO3JES/qv1W9Zs/dyNGBq6EY2X0RMW2449hEQZXdmI42ekNZbSb1tXU00dwLYPINy 3Kz7JSmDvy+kOF8fcUgwKDuHo28RAKKEkf4e+CczgcnPtk0QynlgIomGO0zF/XvwdyYI sMOs5BcWn+/HWg9VykFMTf4VzQa6OAY5T4A6Y1pr5uglpUsVIzMWSlUPTE+iqW3XxJR7 JqMKByv6WgBAvoqNPfbuDh3GtlgvGecYMCQe2vhfyOdCPq7Dct2zcD+TxIrDXOajLd0E 8Z2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=QMNYtpds; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si1658852plk.568.2017.06.29.22.47.10; Thu, 29 Jun 2017 22:47:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=QMNYtpds; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751942AbdF3FrA (ORCPT + 6 others); Fri, 30 Jun 2017 01:47:00 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:33325 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751333AbdF3Fq7 (ORCPT ); Fri, 30 Jun 2017 01:46:59 -0400 Received: by mail-pg0-f45.google.com with SMTP id f127so58489041pgc.0 for ; Thu, 29 Jun 2017 22:46:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YKb3SKp+YykpyYGPW7DjF12C4OYgDfq9gXRJePx0N3Y=; b=QMNYtpds0wgytrB7TUNhPc3lvEnHra5FpNjVgBpzk0Ey/FD+0Kvd4lHUB5Unz2KyC+ X/8/3a5v9v69mAJn+Qr2sPRgKVs0D2H9hXOzFTRZoIKY4DpnsIRfe67yYk0uLutd0WFQ B4ZS2TALWzoQmobCP8ZdU334UUkMft1JwTx/0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YKb3SKp+YykpyYGPW7DjF12C4OYgDfq9gXRJePx0N3Y=; b=FbLOSZ58YsiWSi1/Rc1312gj0Gp9P+1l7eSvQxZEIrE52zDobb3Y93j7IDdp4LGX1Z 8EYBZBkNDorDuFIjCOc0QSwVohM4ujr4cpazq/HZx0Yu4jzAQi/V42nAqYFrgdDYcyjx qS4+wh+syAzBBotiTS9b9IuGNyynQrRL95Ow/Qpk1LO3X6UkOp3NfIeBajnKAp6vq7mi /PezYFEX10KkS+GK+8V+OXmTAfEXBbTaiEhV0iRu8E966TIlqYegJ/1BnnhyM4+ayCRN 1RkOb7ula2MXOGlbovhGzMjxESaeXVidSS8Z9fQF1kKoFRZx+tr0ejaxisJaw7whjQ3G 6m/A== X-Gm-Message-State: AKS2vOxsAJWt2jpVtV1nXjlXXLUleZhJ2ioiksj0nLcx8dQDk+yVhZk1 tlWdxGtJu4LW5T6n X-Received: by 10.101.83.135 with SMTP id x7mr19669062pgq.63.1498801618257; Thu, 29 Jun 2017 22:46:58 -0700 (PDT) Received: from localhost.localdomain ([106.51.129.233]) by smtp.gmail.com with ESMTPSA id a187sm11405550pgc.37.2017.06.29.22.46.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 22:46:57 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Florian Fainelli , "David S . Miller" Subject: [PATCH for-4.4 04/16] net: korina: Fix NAPI versus resources freeing Date: Fri, 30 Jun 2017 11:16:28 +0530 Message-Id: <1498801600-20896-5-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498801600-20896-1-git-send-email-amit.pundir@linaro.org> References: <1498801600-20896-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Florian Fainelli commit e6afb1ad88feddf2347ea779cfaf4d03d3cd40b6 upstream. Commit beb0babfb77e ("korina: disable napi on close and restart") introduced calls to napi_disable() that were missing before, unfortunately this leaves a small window during which NAPI has a chance to run, yet we just freed resources since korina_free_ring() has been called: Fix this by disabling NAPI first then freeing resource, and make sure that we also cancel the restart task before doing the resource freeing. Fixes: beb0babfb77e ("korina: disable napi on close and restart") Reported-by: Alexandros C. Couloumbis Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Amit Pundir --- To be cherry-picked on linux-3.18.y and linux-4.9.y as well. drivers/net/ethernet/korina.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c index d74f5f4e5782..07eabf72c480 100644 --- a/drivers/net/ethernet/korina.c +++ b/drivers/net/ethernet/korina.c @@ -900,10 +900,10 @@ static void korina_restart_task(struct work_struct *work) DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR, &lp->rx_dma_regs->dmasm); - korina_free_ring(dev); - napi_disable(&lp->napi); + korina_free_ring(dev); + if (korina_init(dev) < 0) { printk(KERN_ERR "%s: cannot restart device\n", dev->name); return; @@ -1064,12 +1064,12 @@ static int korina_close(struct net_device *dev) tmp = tmp | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR; writel(tmp, &lp->rx_dma_regs->dmasm); - korina_free_ring(dev); - napi_disable(&lp->napi); cancel_work_sync(&lp->restart_task); + korina_free_ring(dev); + free_irq(lp->rx_irq, dev); free_irq(lp->tx_irq, dev); free_irq(lp->ovr_irq, dev);