Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3525298pxf; Mon, 15 Mar 2021 11:29:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqhqZmB5gy2MvSrgNyU2VdW2sU1x9Kl7APnRLgDPyDXMZ2KxLSFaL1U9uWQvP94/CmeL8H X-Received: by 2002:a17:906:4e17:: with SMTP id z23mr25424417eju.439.1615832991766; Mon, 15 Mar 2021 11:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832991; cv=none; d=google.com; s=arc-20160816; b=rJuHI5DE5Synvgrfj20T/PG1T0jYz0koabauOgVVdTwSV+4VckKdrT/11uD/2k4tou jHWuUv1KtVSdtXGeotnaJejM9kF9g0FSisMVGsmAYj/iHA9G2/fGqt6P/OCVVEtSjpaw cp3KB5D4e4/wQ+Auxoak6G/1SZ2vHN0QPc/JVx4BDSDKFOHy4k0XwGVZJMnHIBPhajlm C1N3WM24ADK/5YxJIxi6+OrNc/wo7mcw/XIavDKg2lU6HBaN8DygpwakdVC6rzaxXPsn x2O3fUVS40UXKrm68LIb7GN0X1CwsPuoxpIjD+19xGbd734D2Eeixzn5b85pBPE+SBuh FDcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yuegTn/NdYW1Lx9hZvEjFV5nRP+Kc6JTbDWsmwBegAw=; b=ShSWxKXeKcwiMA9pyOi7BSF/FP7QcmD5NKoJ4hmycAkJiII3rHql/yKUHgvGlQW2jd HXL5s38tRdXbq/Vqmi2cRSDvTuguVH3a2r6QsUsL6aiSHfbyA8l2OpdqebOkVd59ZqkD sYe7hKfy8150Y497ygwp7UIRUARNRh+XvtZPo8MgbJCIWnBB1IGDEf89PEtqtvE4y6jQ TXga3UtVMd+0miTKjbbXDfxtXnLfpitvps6Ntb6KRk/XyjAs8hy9rSjPNsUErTVYX/Wi A3qeqzRmb14PELRXuhPPeJ2AmNThMSpin6S0peG1bO1OCBj2MmSV+tqOWIXyecEvcnAI RelA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dDRl0JEs; 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 m21si11147752edp.392.2021.03.15.11.29.26; Mon, 15 Mar 2021 11:29:51 -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=dDRl0JEs; 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 S235988AbhCOOes (ORCPT + 99 others); Mon, 15 Mar 2021 10:34:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:35186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233452AbhCOOBm (ORCPT ); Mon, 15 Mar 2021 10:01:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 70B3E64F1E; Mon, 15 Mar 2021 14:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816892; bh=Wv3ykn6IIN7P5T4fDdFyXgqnYKZoGNVkgDy3kpC6dBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dDRl0JEsoUH0a/NTD3RNoIhhJe057VAl4feg5J6OYmvGeIjYsQxrsdGEEZyUKTRNi wilYSBgTKDY2hlPgPhW65GczMHeqc2fHLRFi7F5MNxsedv8fUVSkDF+Pi/IGm3tiqi iOQB50ejkEmRT4SSVss3bx0uxnhB9g13rH9jorYI= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Abhishek Sahu Subject: [PATCH 5.10 172/290] ALSA: hda/hdmi: Cancel pending works before suspend Date: Mon, 15 Mar 2021 14:54:25 +0100 Message-Id: <20210315135547.711876844@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Takashi Iwai commit eea46a0879bcca23e15071f9968c0f6e6596e470 upstream. The per_pin->work might be still floating at the suspend, and this may hit the access to the hardware at an unexpected timing. Cancel the work properly at the suspend callback for avoiding the buggy access. Note that the bug doesn't trigger easily in the recent kernels since the work is queued only when the repoll count is set, and usually it's only at the resume callback, but it's still possible to hit in theory. BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1182377 Reported-and-tested-by: Abhishek Sahu Cc: Link: https://lore.kernel.org/r/20210310112809.9215-4-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_hdmi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2475,6 +2475,18 @@ static void generic_hdmi_free(struct hda } #ifdef CONFIG_PM +static int generic_hdmi_suspend(struct hda_codec *codec) +{ + struct hdmi_spec *spec = codec->spec; + int pin_idx; + + for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { + struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); + cancel_delayed_work_sync(&per_pin->work); + } + return 0; +} + static int generic_hdmi_resume(struct hda_codec *codec) { struct hdmi_spec *spec = codec->spec; @@ -2498,6 +2510,7 @@ static const struct hda_codec_ops generi .build_controls = generic_hdmi_build_controls, .unsol_event = hdmi_unsol_event, #ifdef CONFIG_PM + .suspend = generic_hdmi_suspend, .resume = generic_hdmi_resume, #endif };