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: 279685 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 774022C00A7 for ; Wed, 2 Oct 2013 20:57:57 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753809Ab3JBK5y (ORCPT ); Wed, 2 Oct 2013 06:57:54 -0400 Received: from mail-bk0-f43.google.com ([209.85.214.43]:34966 "EHLO mail-bk0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753425Ab3JBK5u (ORCPT ); Wed, 2 Oct 2013 06:57:50 -0400 Received: by mail-bk0-f43.google.com with SMTP id mz13so254190bkb.30 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 Cc: David Miller , Lennert Buytenhek , Jason Cooper , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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);