Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3311496pxf; Mon, 15 Mar 2021 06:56:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYAwzOPpQzjzYLpf2evLIX4ZcWqIf1171Rm0GUBzC1ZJsxtKR2a1J19sP3gH+PP7IRxo9w X-Received: by 2002:a05:6402:14cc:: with SMTP id f12mr31158952edx.19.1615816567980; Mon, 15 Mar 2021 06:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615816567; cv=none; d=google.com; s=arc-20160816; b=vbbpgvf4D3rO2K4JBiPbqOxLJGEAGnk1M0huVRpEfbiDYzhS0t/7SBTJSX/3Ii+gqx So1xlAkimQmCJ0ZM181I8I/3Ktejtc07XCajtqm4zmrO1V2ttSqpJXjSkzv7seD/EyXM QmW6XJm1yqRqudZOhxEXL2QG6OCj7494hIiTNyguOE7BHiSFMTi7sRWnwqabV2qMgu/8 hcmq8LfGdnMtk1gyB4uo/gfrBoV75teQDI2DX7CVWD7bQsnrPN70P066ICFyykA5HLMk Ek95fz+8Sgcui1n8SKYXFwgWniM9cvekmt9mzMaSCkz7r8AYQug4vidYMzPLi5FqEjpY uvkw== 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=/CrCXzHPqxha6OYSaWVmjoESl4mcZhHAuzGclOAKWpo=; b=XuXmUFrmMDZrknVzz8Y06ab1tHd262Mw8DV1KY0Q1fcRkv7w7ucyNJkzVWVXa53ra0 qthtSqcbleANfWmRUbDZCOK7PhLQRIIQ5x8Gw+/9XsplkuL/bkfDvsDDPmFksLsaIuuR PDvFXlhDkvXMyEflpigPV0gOsOQlFxgUWF9upFwZKQcH2QLruNaPDT9a2NaIn2Ha21a4 yBoD99CTSLmgTLFtlh5h06tLSBY2DGckdTsCMk6reeHQ6oHJ8xA9LrJbqosqFTSEQAvH QHtPAZdtDwhhE/QSSLE8MTlybZe6RLioyaj8mY418YS+JB4/TwBF5orWxBxTjKy39dXT LKvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eoswRizM; 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 4si11626381edc.316.2021.03.15.06.55.45; Mon, 15 Mar 2021 06:56:07 -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=eoswRizM; 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 S229802AbhCONyq (ORCPT + 99 others); Mon, 15 Mar 2021 09:54:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:55892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230359AbhCONx0 (ORCPT ); Mon, 15 Mar 2021 09:53:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A07EA64EEA; Mon, 15 Mar 2021 13:53:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816405; bh=anEz+FV5rQBu38JhslWrT29hgWs+rK69w8HR3rmFtaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eoswRizMuycD8nDwAjY/IxuBd6dNHSm9h1vPrWmMOUC0X3q7KEPJSSwhm2GyXldn4 N3ni9Yew1HLGXAYyWrA2ldh4f6A0WcHb5jx2AC6xbUeFmdEmWOAADzPsMGlaFis7Vh hsa1koUKaN/4Fer93XgP5LSaszpDBCl6Tbh5JeXk= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Abhishek Sahu Subject: [PATCH 4.4 25/75] ALSA: hda/hdmi: Cancel pending works before suspend Date: Mon, 15 Mar 2021 14:51:39 +0100 Message-Id: <20210315135209.070326750@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135208.252034256@linuxfoundation.org> References: <20210315135208.252034256@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 @@ -2239,6 +2239,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; @@ -2262,6 +2274,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 };