Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80FA0C433DB for ; Thu, 4 Feb 2021 17:42:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 16E9A64DF8 for ; Thu, 4 Feb 2021 17:42:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16E9A64DF8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EE1B6165E; Thu, 4 Feb 2021 18:41:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EE1B6165E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1612460548; bh=0bmhCQuHggyzgvaTbKNBrezM2BH9MWvgResqORFWeyI=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CD7564/k9yUl2MCbKxkaoIXZVZQWLNICKrEZgaLZVPLfTNWp3q4ay310p8CL+K56Z yWuNAwMPG6RBlm9EbjXOu/4FxMO8t6YZsITMr3o398gVFaPRpY5sUOcZn8Zi+hoJkx R+fcyw0k3VMr+5230Qnce4hU5o+30Ql39AvJegsk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6B7ABF80155; Thu, 4 Feb 2021 18:41:37 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B7535F80171; Thu, 4 Feb 2021 18:41:35 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B320DF80152 for ; Thu, 4 Feb 2021 18:41:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B320DF80152 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DB20DAC45; Thu, 4 Feb 2021 17:41:28 +0000 (UTC) Date: Thu, 04 Feb 2021 18:41:28 +0100 Message-ID: From: Takashi Iwai To: Ranjani Sridharan Subject: Re: [PATCH] ASoC: rt5682: Fix panic in rt5682_jack_detect_handler happening during system shutdown In-Reply-To: <20210204172724.2299583-1-ranjani.sridharan@linux.intel.com> References: <20210204172724.2299583-1-ranjani.sridharan@linux.intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: alsa-devel@alsa-project.org, Jairaj Arava , broonie@kernel.org, Sathyanarayana Nujella , Shuming Fan , Pierre-Louis Bossart X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Thu, 04 Feb 2021 18:27:24 +0100, Ranjani Sridharan wrote: > > From: Sathyanarayana Nujella > > During Coldboot stress tests, system encountered the following panic. > Panic logs depicts rt5682_i2c_shutdown() happened first and then later > jack detect handler workqueue function triggered. > This situation causes panic as rt5682_i2c_shutdown() resets codec. > Fix this panic by cancelling properly delayed work. > > Panic log: > [ 20.936124] sof_pci_shutdown > [ 20.940248] snd_sof_device_shutdown > [ 20.945023] snd_sof_shutdown > [ 21.126849] rt5682_i2c_shutdown > [ 21.286053] rt5682_jack_detect_handler > [ 21.291235] BUG: kernel NULL pointer dereference, address: 000000000000037c > [ 21.299302] #PF: supervisor read access in kernel mode > [ 21.305254] #PF: error_code(0x0000) - not-present page > [ 21.311218] PGD 0 P4D 0 > [ 21.314155] Oops: 0000 [#1] PREEMPT SMP NOPTI > [ 21.319206] CPU: 2 PID: 123 Comm: kworker/2:3 Tainted: G U 5.4.68 #10 > [ 21.333687] ACPI: Preparing to enter system sleep state S5 > [ 21.337669] Workqueue: events_power_efficient rt5682_jack_detect_handler [snd_soc_rt5682] > [ 21.337671] RIP: 0010:rt5682_jack_detect_handler+0x6c/0x279 [snd_soc_rt5682] > > Fixes: a50067d4f3c1d ('ASoC: rt5682: split i2c driver into separate module') > Signed-off-by: Jairaj Arava > Signed-off-by: Sathyanarayana Nujella > Reviewed-by: Pierre-Louis Bossart > Reviewed-by: Shuming Fan > Signed-off-by: Ranjani Sridharan > --- > sound/soc/codecs/rt5682-i2c.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sound/soc/codecs/rt5682-i2c.c b/sound/soc/codecs/rt5682-i2c.c > index 37d13120f5ba..6effd2611e3c 100644 > --- a/sound/soc/codecs/rt5682-i2c.c > +++ b/sound/soc/codecs/rt5682-i2c.c > @@ -273,6 +273,8 @@ static void rt5682_i2c_shutdown(struct i2c_client *client) > { > struct rt5682_priv *rt5682 = i2c_get_clientdata(client); > > + cancel_delayed_work_sync(&rt5682->jack_detect_work); > + > rt5682_reset(rt5682); > } The driver has two works. Doesn't another one need Canceling? Just to be sure... thanks, Takashi