Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3661797rdb; Sun, 10 Dec 2023 15:38:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IE46fXSCenOQ/bVSGM8qBrFoqj1McG3wzP5Au1kVa9SHocYY2uzNfOdbSkqV0CoiFdrMD3N X-Received: by 2002:a05:6808:1442:b0:3b8:b89b:5ecb with SMTP id x2-20020a056808144200b003b8b89b5ecbmr4322651oiv.71.1702251491105; Sun, 10 Dec 2023 15:38:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702251491; cv=none; d=google.com; s=arc-20160816; b=Wx6O3KvM03/cznXgNjS83zbTPWfpbrzX7/swoQ8QkXb8TBFjHTRiX2wis2jLAyUyCQ Hw9kRrEKVRl2BcW9+aKhHwMOZcI3t/3ISUzyw96BKQspk/QrXy72X1q/ecZJezQVd0+F QUnInTGH6zWIBbr153sT88Ng9st+ZTzmcdU2ipeGKzZtFz3haSV+Y/bnu1LwNXmhzbEE GO+Nir7ffo8FnH13ex4CFwb4t6SFxKyVVLdcS7bSfHRAXxhmvgXk6QZcUiZErIALuNc5 L9epPt4y2hTt9KtjzZ4g7BbarUKjjscrz7AsBlGomYegQ4oqAlbyVZ0fCcjdhIv89Q1s US3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=/I0UcSJpLuyPk052zzyGwQqvu0OdQ0z2nOCmLN02QjI=; fh=AtUyipZqf9Wt3VmKECtwTscIVbxtj0bqEzvKFfEmcRc=; b=zG5w3NSnG6VYUL3fYqSIKD5tv9CWr7tcF7CqAmfq8FTQY8g5fo5B78uDsP0wqq0jBL YyLm8v9dNE+O6DQj3Ol8kACxpMtQW20qvH+qiqj4AmVtBhnuH0jt9Ze7ZGqfQJDXVIUy NPkucDEbXrWk868bTfx/xsMGEPMddQEShH+8ytSa0aC/z8drW/gcz7jQ9ccOzZfKUnPI as2aK63oNtpgVf/k8BR2b7O2tdaN2MoCMmqKZrnkOX4gPnVIwXtgwcXnM9qr6VzIr2lu GoV6Te7HC04iXptOqyRf8OR+YHE+LEOZbLKWRDjGBAJy/f5Zp98C3He33eWFxjEez7Id XyhQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=irl.hu Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b16-20020aa78710000000b0068e3f550763si5052902pfo.101.2023.12.10.15.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 15:38:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=irl.hu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 65EF28086524; Sun, 10 Dec 2023 15:38:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230162AbjLJXhj (ORCPT + 99 others); Sun, 10 Dec 2023 18:37:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbjLJXhh (ORCPT ); Sun, 10 Dec 2023 18:37:37 -0500 Received: from irl.hu (irl.hu [95.85.9.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31F82EB; Sun, 10 Dec 2023 15:37:44 -0800 (PST) Received: from fedori.lan (51b690cd.dsl.pool.telekom.hu [::ffff:81.182.144.205]) (AUTH: CRAM-MD5 soyer@irl.hu, ) by irl.hu with ESMTPSA id 000000000006E46F.0000000065764BC4.0012065E; Mon, 11 Dec 2023 00:37:40 +0100 From: Gergo Koteles To: Shenghao Ding , Kevin Lu , Baojun Xu , Jaroslav Kysela , Takashi Iwai Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Gergo Koteles , stable@vger.kernel.org Subject: [PATCH] ALSA: hda/tas2781: handle missing EFI calibration data Date: Mon, 11 Dec 2023 00:37:33 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Mime-Autoconverted: from 8bit to 7bit by courier 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 10 Dec 2023 15:38:08 -0800 (PST) The code does not properly check whether the calibration variable is available in the EFI. If it is not available, it causes a NULL pointer dereference. Check the return value of the first get_variable call also. BUG: kernel NULL pointer dereference, address: 0000000000000000 Call Trace: ? __die+0x23/0x70 ? page_fault_oops+0x171/0x4e0 ? srso_alias_return_thunk+0x5/0x7f ? schedule+0x5e/0xd0 ? exc_page_fault+0x7f/0x180 ? asm_exc_page_fault+0x26/0x30 ? crc32_body+0x2c/0x120 ? tas2781_save_calibration+0xe4/0x220 [snd_hda_scodec_tas2781_i2c] tasdev_fw_ready+0x1af/0x280 [snd_hda_scodec_tas2781_i2c] request_firmware_work_func+0x59/0xa0 Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver") CC: stable@vger.kernel.org Signed-off-by: Gergo Koteles --- sound/pci/hda/tas2781_hda_i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c index fb802802939e..6e506efe61cd 100644 --- a/sound/pci/hda/tas2781_hda_i2c.c +++ b/sound/pci/hda/tas2781_hda_i2c.c @@ -455,9 +455,9 @@ static int tas2781_save_calibration(struct tasdevice_priv *tas_priv) status = efi.get_variable(efi_name, &efi_guid, &attr, &tas_priv->cali_data.total_sz, tas_priv->cali_data.data); - if (status != EFI_SUCCESS) - return -EINVAL; } + if (status != EFI_SUCCESS) + return -EINVAL; tmp_val = (unsigned int *)tas_priv->cali_data.data; base-commit: ffc253263a1375a65fa6c9f62a893e9767fbebfa -- 2.43.0