[bug report] ALSA: hda: cs35l41: Ensure firmware/tuning pairs are always loaded

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

 



Hello Stefan Binding,

The patch cd40dad2ca91: "ALSA: hda: cs35l41: Ensure firmware/tuning
pairs are always loaded" from Feb 13, 2023, leads to the following
Smatch static checker warning:

	sound/pci/hda/cs35l41_hda.c:303 cs35l41_request_firmware_files()
	warn: passing freed memory '*wmfw_firmware'

sound/pci/hda/cs35l41_hda.c
    291         release_firmware(*wmfw_firmware);
    292         kfree(*wmfw_filename);
                      ^^^^^^^^^^^^^^

    293 
    294         /* fallback try cirrus/part-dspN-fwtype.wmfw */
    295         ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename,
                                                             ^^^^^^^^^^^^^
Assume kasprintf() fails at the start of the function.  Better to set
*wmfw_firmware = NULL as the very first line of the function.

    296                                             CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "wmfw");
    297         if (!ret)
    298                 /* fallback try cirrus/part-dspN-fwtype.bin */
    299                 ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename,
    300                                                     CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin");
    301 
    302         if (ret) {
--> 303                 release_firmware(*wmfw_firmware);
                                         ^^^^^^^^^^^^^^
Use after free.

    304                 kfree(*wmfw_filename);
    305                 dev_warn(cs35l41->dev, "Unable to find firmware and tuning\n");
    306         }
    307         return ret;
    308 }

regards,
dan carpenter



[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