Re: [PATCH v2] ALSA: hda: handle UAF at probe error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 14, 2022 at 08:24:37PM +0200, Nirmoy Das wrote:
Call snd_card_free_on_error() on probe error instead of
calling snd_card_free() which should handle devres call orders.

Issues: https://gitlab.freedesktop.org/drm/intel/-/issues/5701
Fixes: e8ad415b7a55 ("ALSA: core: Add managed card creation")
Signed-off-by: Nirmoy Das <nirmoy.das@xxxxxxxxx>

This failure in i915 CI seems suspicious since is around module removal.
https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102714v1/fi-tgl-1115g4/igt@i915_suspend@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

And it seems it didn't fix the issue in dg2:

https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_102714v1/bat-dg2-8/igt@gem_lmem_swapping@xxxxxxxxxxxxxxxxxxx

Lucas De Marchi

---
sound/pci/hda/hda_intel.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 82a45f2b31c4..eb4228c9e37f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1730,7 +1730,9 @@ static void azx_check_snoop_available(struct azx *chip)
static void azx_probe_work(struct work_struct *work)
{
	struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work);
-	azx_probe_continue(&hda->chip);
+	struct azx *chip = &hda->chip;
+
+	snd_card_free_on_error(&chip->pci->dev, azx_probe_continue(chip));
}

static int default_bdl_pos_adj(struct azx *chip)
@@ -2028,7 +2030,7 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
		dev_err(card->dev, "Cannot load firmware, continue without patching\n");
	if (!chip->disabled) {
		/* continue probing */
-		azx_probe_continue(chip);
+		snd_card_free_on_error(&chip->pci->dev, azx_probe_continue(chip));
	}
}
#endif
@@ -2338,7 +2340,6 @@ static int azx_probe_continue(struct azx *chip)
out_free:
	if (err < 0) {
		pci_set_drvdata(pci, NULL);
-		snd_card_free(chip->card);
		return err;
	}

--
2.35.1




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux