From patchwork Wed Jul 6 12:02:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 12908044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 60872C433EF for ; Wed, 6 Jul 2022 11:54:05 +0000 (UTC) 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 7913F16C3; Wed, 6 Jul 2022 13:53:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7913F16C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657108443; bh=dieqkM5s8040Xr/uwJHnUztLAPbicPv2r2/NubJgwf0=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=oyv/ptTDASAfIRIdPJrrz7s6IN6bIjWKTdKj2e87xT95ojDrjnA/Pv1Q4bsRRHloA bFnuks8sLKrgvMLz6p3VNo5S7tnTt3iNtQ0+BouNuJ/bWZbYCBTmZhTccMoPpZ01mb k8zMUK9e4z1ugGe2rXL48kwEIShnsmCGOSgiueoc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B2E36F804ED; Wed, 6 Jul 2022 13:52:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AF067F8052E; Wed, 6 Jul 2022 13:52:44 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 21A92F80104 for ; Wed, 6 Jul 2022 13:52:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 21A92F80104 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZfAyEvot" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657108359; x=1688644359; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=dieqkM5s8040Xr/uwJHnUztLAPbicPv2r2/NubJgwf0=; b=ZfAyEvots6red1CCXoC/2qEnU+DuVb0FzvlEzoaIhkE8ujx3apStqe+T F075uH6KrH6SnwOorZrxvMyFa8C3KUzyLTF6WXyzq4x43WoPrDMFDYBXo xbMbT05GiYoO5+j9PrX8tUSPgwarLX+YvzG35ANuoX9UA8LC6f2pjPLUY q++o+tMUXe7cmyPBuFLXYR0TtAnYbcmPcviBVhN92FPxMZ8ok4gfWTJTX 6imoP3OcDppOfSclRsQz0/Bj989Ygo6+73UY2ZXMhJs0pqCUhUgNDSl7/ EROpHI5kF1VygaHxp0KNh0l7tWdxzO8QECWh7AN4tsqx20zTEIvUrzfhO A==; X-IronPort-AV: E=McAfee;i="6400,9594,10399"; a="370042591" X-IronPort-AV: E=Sophos;i="5.92,249,1650956400"; d="scan'208";a="370042591" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jul 2022 04:52:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,249,1650956400"; d="scan'208";a="920136246" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by fmsmga005.fm.intel.com with ESMTP; 06 Jul 2022 04:52:32 -0700 From: Cezary Rojewski To: alsa-devel@alsa-project.org, tiwai@suse.com Subject: [PATCH 0/9] ALSA: hda: Codec-reload bug fixes and cleanups Date: Wed, 6 Jul 2022 14:02:21 +0200 Message-Id: <20220706120230.427296-1-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Cc: Cezary Rojewski , pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com, broonie@kernel.org, amadeuszx.slawinski@linux.intel.com 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" Total of 6 fixes and 3 cleanups - cleanups are last. All of the fixes address problems that present themselves in situation when user engages in codec driver reload. Second condition to reproduce is two-step initialization of HDAudio codec - this is the case only for ASoC HDAudio bus driver as snd_hda_intel calls only compound function snd_hda_codec_new(). Once these conditions are met, several reload/unload scenarios end with null-ptr-deref and page faults. Goal of the series is to allow codec/bus driver reloading without any errors. Amadeusz Sławiński (2): ALSA: hda: Reset all SIE bits in INTCTL ALSA: hda: Remove unused macro definition Cezary Rojewski (7): ALSA: hda: Do not unset preset when cleaning up codec ALSA: hda: Fix null-ptr-deref when i915 fails and hdmi is denylisted ALSA: hda: Make device usage_count consistent across subsequent probing ALSA: hda: Fix put_device() inconsistency in error path ALSA: hda: Skip event processing for unregistered codecs ALSA: hda: Fix page fault in snd_hda_codec_shutdown() ALSA: hda/realtek: Remove redundant init_hook() in alc_default_init() include/sound/hda_codec.h | 1 - include/sound/hdaudio.h | 1 + sound/hda/ext/hdac_ext_controller.c | 7 --- sound/hda/hdac_bus.c | 2 +- sound/hda/hdac_controller.c | 7 +-- sound/pci/hda/hda_bind.c | 7 +++ sound/pci/hda/hda_codec.c | 83 +++++++++++++++-------------- sound/pci/hda/patch_realtek.c | 3 -- sound/soc/codecs/hda.c | 4 +- 9 files changed, 56 insertions(+), 59 deletions(-)