Skip to contentSkip to conversation

ALSA: hda/intel: Move firmware loading into the probe work

PATCH New Takashi Iwai 1 participant 1 message Apr 15 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda/intel: Move firmware loading into the probe work

The hda-intel driver uses request_firmware_nowait() for loading its patch, and tries to continue the probe directly from the fw loader callback. This works in principle, but it has a few drawbacks:

- The driver may be released before the firmware callback completes
- Having two ways of async probe makes the code flow unnecessarily complex

The former issue is more severe, as it may potentially lead to a UAF, and there is no explicit way to cancel the pending firmware worker for now.

This patch changes the firmware loading to be performed rather in the common probe work without *_nowait(). Then the pending work can be easily canceled, and the code becomes more straightforward.

A nice bonus is that, by moving into the probe work, the firmware doesn't need any longer to be cached, hence we can get rid of struct azx.fw field, and release the firmware immediately after parsing it, too.

Fixes 5cb543dba986 ("ALSA: hda - Deferred probing with request_firmware_nowait()")
---
 sound/hda/common/hda_controller.h |  4 ---
 sound/hda/controllers/intel.c     | 58 ++++++++-----------------------
 2 files changed, 15 insertions(+), 47 deletions(-)
sound/hda/common/hda_controller.h +0 -4
index c2d0109866e6..7434f38038a0 100644
@@ -127,10 +127,6 @@ struct azx {
 	unsigned int beep_mode;
 	bool ctl_dev_id;
 
-#ifdef CONFIG_SND_HDA_PATCH_LOADER
-	const struct firmware *fw;
-#endif
-
 	/* flags */
 	int bdl_pos_adj;
 	unsigned int running:1;
sound/hda/controllers/intel.c +15 -43

88 lines not on this page · raw message

Signature · 1 line
2.53.0