From patchwork Wed Oct 2 10:57:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 2974261 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 46F3E9F288 for ; Wed, 2 Oct 2013 10:59:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 400B22017D for ; Wed, 2 Oct 2013 10:59:55 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 67DC6203A8 for ; Wed, 2 Oct 2013 10:59:50 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VRK8e-0006I5-CO; Wed, 02 Oct 2013 10:58:40 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VRK8S-0004Z9-06; Wed, 02 Oct 2013 10:58:28 +0000 Received: from mail-bk0-x22b.google.com ([2a00:1450:4008:c01::22b]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VRK8A-0004UE-Rx for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2013 10:58:12 +0000 Received: by mail-bk0-f43.google.com with SMTP id mz13so245130bkb.16 for ; Wed, 02 Oct 2013 03:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RnUeGaJ69m++ej/6CjUONqe3MQw8V2bx9xU3fBr+dgc=; b=grmvvGkR5w+lxJ37YrQ4e/1PieGQi3DpvFAHHLGeZq+Ucu708+fV/avZSgW0lAdgmO Mikf269iHaMt5ITEkJhOJs1gZPEazQBNjksWYkdELz79Lcv7x5r+G70QVvPa1zUO33q+ lc/H4/MEuHzb2KWsH6Ctjph96x10IqvRJCI4epn36uc+JeDQAbW4Vi7z4iun8esOAVZS jIMzKGsh5GBBZn4eE1e+NNR3D1F56bmgQ8CA0Ii2aT7u2/hSS0WqIIoM2/g4hli3nSG+ 8ljfUSDwIRoDwr7Thb3szpH5S33+wn81p0NPgrpa58MpB7bGFJVFU+bvQaRyibdXIgRw Rr3g== X-Received: by 10.204.229.76 with SMTP id jh12mr470501bkb.44.1380711468898; Wed, 02 Oct 2013 03:57:48 -0700 (PDT) Received: from topkick.lan (dslc-082-083-247-252.pools.arcor-ip.net. [82.83.247.252]) by mx.google.com with ESMTPSA id qe6sm826680bkb.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 03:57:48 -0700 (PDT) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH 2/3] net: mv643xx_eth: fix orphaned statistics timer crash Date: Wed, 2 Oct 2013 12:57:21 +0200 Message-Id: <1380711442-24735-3-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1380711442-24735-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1380711442-24735-1-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131002_065811_159868_957C86AA X-CRM114-Status: GOOD ( 11.50 ) X-Spam-Score: -2.0 (--) Cc: Jason Cooper , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lennert Buytenhek , David Miller , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The periodic statistics timer gets started at port _probe() time, but is stopped on _stop() only. In a modular environment, this can cause the timer to access already deallocated memory, if the module is unloaded without starting the eth device. To fix this, we add the timer right before the port is started, instead of at _probe() time. Signed-off-by: Sebastian Hesselbarth Acked-by: Jason Cooper --- Cc: David Miller Cc: Lennert Buytenhek Cc: Jason Cooper Cc: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/net/ethernet/marvell/mv643xx_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 44a87e4..2364707 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2235,6 +2235,7 @@ static int mv643xx_eth_open(struct net_device *dev) mp->int_mask |= INT_TX_END_0 << i; } + add_timer(&mp->mib_counters_timer); port_start(mp); wrlp(mp, INT_MASK_EXT, INT_EXT_LINK_PHY | INT_EXT_TX); @@ -2914,7 +2915,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev) mp->mib_counters_timer.data = (unsigned long)mp; mp->mib_counters_timer.function = mib_counters_timer_wrapper; mp->mib_counters_timer.expires = jiffies + 30 * HZ; - add_timer(&mp->mib_counters_timer); spin_lock_init(&mp->mib_counters_lock);