Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3477908pxb; Mon, 4 Oct 2021 03:14:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWQCLkWZqPIV5LZ60kU+sy9eS4F+ze5KWVClBHcchWg5Hjc0NhoB68ONQjtCkRdaB32Ezr X-Received: by 2002:a17:902:8f8a:b0:13d:abff:19cf with SMTP id z10-20020a1709028f8a00b0013dabff19cfmr22650462plo.15.1633342475645; Mon, 04 Oct 2021 03:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633342475; cv=none; d=google.com; s=arc-20160816; b=rCg34WYcbijc+n5Uj57DFjQUGzp32nZ7obdZR+AwdieB3kxZXSy3gIPuk3++8kl5dc Z724Xx8zgzc7Z+8w0zOArn7W6k99aW6ph06mmE/elENYRW8dnG5+pIHLrJ21xAd5Agjy Q3T3+wUQa3eYZIwGQ8faWsc5i6qPtlD0/duR1w1ksmEPTTX1zChndjPugwVOGqO4G+Lm /YW3fuSXsfPzzOIxmkhrkl6464S15paGyi/O9jCQAL4LzljHW9czJCsThJ9x/N1DklL5 XSKS0DG6+w03HlpJQdHThGK70nzcPhgGu8lYd8bjmrIT3ZHzNryNn1L+5hnStVj4wDjD WeBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=epT0mHb4sdOeEQAB2JQeOJMwTEY+Gt1dw09lUBwdaNI=; b=r31eAQLscXO/HmQ5YEZOgFLHDfJnRTQHWMTysNCMbVvbbLIQ76/u/qscggDNI29koO ms5pavvpdg7SJHu57Ig3Ehyjg8ysvvlYZKw4Wh/mn+qza5zJVTRMAvQCibmmZB1jxllw 4H7neUZ2tP8zCAOy6VjhDUlkZrQ6vbDHZMPQggmuOvL2W4NGXDgSzPrpslsBOrSqhj/v J/ryLQV4ZTrUmMBfHndYJpAzJHZeVrvQfGe8GjeVvxA/3BvrooFV9n+1w5ZMyKXNwaZA wxL54cD3HXoylZxjSTKVDsISApzEytL/A+L4PJV1l0vtz91HuT4vdGAVVUhoGKXkeHo+ MjXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y59mMT+R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v7si17523704plp.156.2021.10.04.03.14.23; Mon, 04 Oct 2021 03:14:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y59mMT+R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231995AbhJDKNS (ORCPT + 99 others); Mon, 4 Oct 2021 06:13:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:33860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbhJDKNR (ORCPT ); Mon, 4 Oct 2021 06:13:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 181846128A; Mon, 4 Oct 2021 10:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633342288; bh=1FSxfpr/+AzmR56G+WHMLcUMmcad+HJ+4J+awlrJc74=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Y59mMT+RPi9DqLc0Wka7wXw2M2M21GlY/CeMGz8rg8M9pqDaIDFlGZ91Xpd3GgLuI syQGEASbts46K9fNVmHs/WuNNQ98A+RVkYfl6mUYBWleNkBj+BV4TTMFvbwDIHp8Zf GwI0cVaQ2qM+akXGUBRqlbW+Qs/Bd1TrpFfv7fd8= Date: Mon, 4 Oct 2021 12:11:20 +0200 From: Greg Kroah-Hartman To: Macpaul Lin Cc: Leon Yu , "David S . Miller" , Maxime Coquelin , Alexandre Torgue , Russell King , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, stable@vger.kernel.org, Miles Chen , Bear Wang , Pablo Sun , Fabien Parent , Macpaul Lin , linux-mediatek@lists.infradead.org Subject: Re: [PATCH] net: stmmac: don't attach interface until resume finishes Message-ID: References: <20210928083620.29090-1-macpaul.lin@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210928083620.29090-1-macpaul.lin@mediatek.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 28, 2021 at 04:36:20PM +0800, Macpaul Lin wrote: > From: Leon Yu > > commit 31096c3e8b1163c6e966bf4d1f36d8b699008f84 upstream. > > Commit 14b41a2959fb ("net: stmmac: Delete txtimer in suspend()") was the > first attempt to fix a race between mod_timer() and setup_timer() > during stmmac_resume(). However the issue still exists as the commit > only addressed half of the issue. > > Same race can still happen as stmmac_resume() re-attaches interface > way too early - even before hardware is fully initialized. Worse, > doing so allows network traffic to restart and stmmac_tx_timer_arm() > being called in the middle of stmmac_resume(), which re-init tx timers > in stmmac_init_coalesce(). timer_list will be corrupted and system > crashes as a result of race between mod_timer() and setup_timer(). > > systemd--1995 2.... 552950018us : stmmac_suspend: 4994 > ksoftirq-9 0..s2 553123133us : stmmac_tx_timer_arm: 2276 > systemd--1995 0.... 553127896us : stmmac_resume: 5101 > systemd--320 7...2 553132752us : stmmac_tx_timer_arm: 2276 > (sd-exec-1999 5...2 553135204us : stmmac_tx_timer_arm: 2276 > --------------------------------- > pc : run_timer_softirq+0x468/0x5e0 > lr : run_timer_softirq+0x570/0x5e0 > Call trace: > run_timer_softirq+0x468/0x5e0 > __do_softirq+0x124/0x398 > irq_exit+0xd8/0xe0 > __handle_domain_irq+0x6c/0xc0 > gic_handle_irq+0x60/0xb0 > el1_irq+0xb8/0x180 > arch_cpu_idle+0x38/0x230 > default_idle_call+0x24/0x3c > do_idle+0x1e0/0x2b8 > cpu_startup_entry+0x28/0x48 > secondary_start_kernel+0x1b4/0x208 > > Fix this by deferring netif_device_attach() to the end of > stmmac_resume(). > > Signed-off-by: Leon Yu > Signed-off-by: David S. Miller Whenever you forward on a patch, you should add yourself to the signed-off-by chain. I'll just add you to the cc: to let us know who asked for this patch. thanks, greg k-h