]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ALSA: hda/tas2781: Fix a potential race condition that causes a NULL pointer in case...
authorShenghao Ding <shenghao-ding@ti.com>
Thu, 11 Sep 2025 07:11:31 +0000 (15:11 +0800)
committerTakashi Iwai <tiwai@suse.de>
Thu, 11 Sep 2025 16:11:17 +0000 (18:11 +0200)
A a potential race condition reported by one of my customers that leads to
a NULL pointer dereference, where the call to efi.get_variable should be
guarded with efi_rt_services_supported() to ensure that function exists.

Fixes: 4fe238513407 ("ALSA: hda/tas2781: Move and unified the calibrated-data getting function for SPI and I2C into the tas2781_hda lib")
Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/hda/codecs/side-codecs/tas2781_hda.c
sound/hda/codecs/side-codecs/tas2781_hda_i2c.c

index 536940c78f001dc8b246fcd2bc744cd35957df1a..96e6d82dc69eb1a5be8a96b6e031719d8c3967bc 100644 (file)
@@ -193,6 +193,11 @@ int tas2781_save_calibration(struct tas2781_hda *hda)
        efi_status_t status;
        int i;
 
+       if (!efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) {
+               dev_err(p->dev, "%s: NO EFI FOUND!\n", __func__);
+               return -EINVAL;
+       }
+
        if (hda->catlog_id < LENOVO)
                efi_guid = tasdev_fct_efi_guid[hda->catlog_id];
 
index 45a70fbf620537ff54826310819ada5cc8610d7e..b5b7a1e82b75e6d85df8cbe41026a3a8d86a63cc 100644 (file)
@@ -315,6 +315,11 @@ static int tas2563_save_calibration(struct tas2781_hda *h)
        unsigned int attr;
        int ret, i, j, k;
 
+       if (!efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) {
+               dev_err(p->dev, "%s: NO EFI FOUND!\n", __func__);
+               return -EINVAL;
+       }
+
        cd->cali_dat_sz_per_dev = TAS2563_CAL_DATA_SIZE * TASDEV_CALIB_N;
 
        /* extra byte for each device is the device number */