From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796209189; b=PvZCxhwSPoItLObs3HIEO7voqmVDAvqBxpYsqJif5Ean+IEuDynfvq+RWKXYsQYan7YK np7HvgFiSrR6AwYdgRpCFdP2yE6K2VxmUHlvtcQyb0eE1/Y3B5uKb9j0WQ8wC3LPhoJ3F IBpSrfQl67RIFXxDOHZbj0SjEMrKkbuseNURkaPkvJZnxTst2QEhWDGeRTyDoxmfnaMUp 97EVvC78ugtxU2Z7SJsirCIvZojFkYgFtMIgV71AaH3QhkaJ87c8idx1SSBK5krx/I2d0 S7wDIMIiFf5k6HqjQXleMhjlYr37ARgrw6XfY+sFIr34K5UqupvKnrCScFUZakAU8uQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796209189; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=J/s/g3qYhGrCAtzFRMgpxccR34BgSa46ND0xdpq1uik=; b=NwFDQOznBKdc1d+kQLmCkBpJFvw8KgxCFHcknI6S9bSRZVE5ycz0T3w6r/l4HmvuWs0i jeHJycILFjlxDeHCwJGG9PZA0oyPJl+dawV26LsrlWFbvhYGFCYbduuUrs1Sf+7e6Lqu1 irxzj5T/5G0K8ZUreH5XL82WsIZ4EEUHkusGGGfXCwMB/edC/OJVAaYwsREeaGqUMzQ3N 7alD9U7xGdB29OF4G5qknFsA/iJJl3Z3OcQcJs2zqU9X6ao3aJh2qglZRO9bKNjyyPsZw VtddKKiZmWoaYM1xZGmF47owpg5aduwgQVbfFnP7Z4lk4pTlKsIh//ruY54fUS2LTRw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=M7zFWb30; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE4B4606A31A for ; Wed, 2 Dec 2026 10:59:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=M7zFWb30 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB3241F00893; Wed, 2 Dec 2026 10:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796209189; bh=J/s/g3qYhGrCAtzFRMgpxccR34BgSa46ND0xdpq1uik=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=M7zFWb30la7q+Q6NICYs/UdmS/yHKYX5mLJmGTEaBcPo//9/Us203QvA3LIAj1Ev1 /bt/XL72G1zvHGiXSexHbejIcra0n50haaecqHVn84ytJ91JrCP7Vodn7/Q9MRVyld 6Lx/YDqAACd+r0KySdGuw+Ab3/9TertUCPo+KlhfgJjMvj1gra6TSoqGIZKR8WCmur gGUgrz313AkDX9qp9qQA2OGB0jL7FQ1PmcVKq0NAtPXwOz6UBAzgc3K0oBAY4O6A1H JZq9UvAKYfXwAAYTDvFs8wR1dha/M6mNB91Yh7FGMXXX6Rxex2x4JSVNLm2vFv36tq 9f/zyJ0i57jYQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3] ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure Reply-To: sashiko-reviews@lists.linux.dev To: "Sreeraj S Kurup" Cc: linux-sound@vger.kernel.org In-Reply-To: <20261202103518.4945-1-sreekuttan2156239@gmail.com> References: <20261202094026.4432-1-sreekuttan2156239@gmail.com> <20261202103518.4945-1-sreekuttan2156239@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 10:59:48 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] ALSA: hda: cix-ipbloq: premature snd_device_free() in cix_ipbloq_hda_probe() - [Medium] ALSA: hda: cix-ipbloq: clock and runtime PM imbalance in cix_ipbloq_hda_probe() -- commit e24cdb391cdea38e58578070cee3d1e3249dcceb Author: Sreeraj S Kurup ALSA: hda: cix-ipbloq: Fix runtime PM handling on probe failure This commit updates the error paths in cix_ipbloq_hda_probe() to disable runtime PM, release the runtime PM reference, and disable controller clocks after freeing the ALSA device and card. > diff --git a/sound/hda/controllers/cix-ipbloq.c b/sound/hda/controllers/c= ix-ipbloq.c > index c07098fc13403..2b7979f42a9c9 100644 > --- a/sound/hda/controllers/cix-ipbloq.c > +++ b/sound/hda/controllers/cix-ipbloq.c > @@ -237,6 +237,7 @@ static int cix_ipbloq_hda_probe(struct platform_devic= e *pdev) > struct cix_ipbloq_hda *hda; > struct snd_card *card; > struct azx *chip; > + bool pm_ref =3D false; > int err; > =20 > hda =3D devm_kzalloc_obj(&pdev->dev, *hda); > @@ -284,21 +285,37 @@ static int cix_ipbloq_hda_probe(struct platform_dev= ice *pdev) > err =3D pm_runtime_resume_and_get(hda->dev); > if (err < 0) { > dev_err(hda->dev, "runtime resume and get failed, err =3D %d\n", err); > - goto out_free_device; > + goto out_pm_disable; > } > =20 > + pm_ref =3D true; > + > err =3D cix_ipbloq_hda_init(hda, chip, pdev); > if (err < 0) > - goto out_free_device; > + goto out_pm_cleanup; > =20 > err =3D cix_ipbloq_hda_probe_codec(hda); > if (err < 0) > - goto out_free_device; > + goto out_pm_cleanup; > =20 > pm_runtime_put(hda->dev); > =20 > return 0; > =20 > +out_pm_cleanup: > + pm_runtime_disable(hda->dev); > + snd_device_free(card, chip); > + snd_card_free(card); [Severity: Medium] Does calling snd_device_free(card, chip) before snd_card_free(card) tear down the low-level controller before its codec devices? If cix_ipbloq_hda_probe_codec() fails in azx_codec_configure() or snd_hda_card_register() after azx_probe_codecs() has created codec devices, snd_device_free(card, chip) runs cix_ipbloq_hda_dev_free() first. That frees the CORB/RIRB DMA buffer (bus->rb.area) and calls snd_hdac_bus_exit() while codecs are still on bus->codec_list, triggering WARN_ON(!list_empty(&bus->codec_list)) and causing a use-after-free on bus->corb.buf if a bound codec driver sends HDA verbs when snd_card_free() unregisters the codecs afterward. snd_card_free(card) already frees all devices on the card in order (codec and PCM devices first, SNDRV_DEV_LOWLEVEL last), so snd_device_free(card, chip) can be dropped before snd_card_free(card). > + if (pm_ref) { > + pm_runtime_put_noidle(hda->dev); > + clk_bulk_disable_unprepare(hda->nclocks, hda->clocks); > + } [Severity: Medium] Can clk_bulk_disable_unprepare() underflow the clock enable and prepare counts when CONFIG_PM is disabled? SND_HDA_CIX_IPBLOQ does not depend on CONFIG_PM, and the clocks are only prepared and enabled in cix_ipbloq_hda_runtime_resume(). Under !CONFIG_PM, pm_runtime_resume_and_get() returns 0 without running the callback, so calling clk_bulk_disable_unprepare() here triggers WARN() in clk_core_disable() and clk_core_unprepare(). When CONFIG_PM is enabled, disabling runtime PM before dropping the reference and manually disabling the clocks also bypasses runtime suspend and any attached PM domain callback, and pm_ref is always true at out_pm_cleanup. Calling pm_runtime_put_sync() and pm_runtime_disable() after snd_card_free(card) would let runtime PM suspend the device cleanly after ALSA teardown. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202103518.4945= -1-sreekuttan2156239@gmail.com?part=3D1