Message ID | f1f6583bda918f78556f67d522ca7b3b91cebbd5.1702251102.git.soyer@irl.hu |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6742895vqy; Sun, 10 Dec 2023 15:38:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEvaJFYh15eue0lGT0CAR4eN3L6Q2Kgfa2/MzxCLVxA3paQ7kaubnKIN/cwifhTzFoGgc/ X-Received: by 2002:a05:6870:5147:b0:1fb:75a:de5f with SMTP id z7-20020a056870514700b001fb075ade5fmr4980777oak.77.1702251487421; Sun, 10 Dec 2023 15:38:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702251487; cv=none; d=google.com; s=arc-20160816; b=ztDBlFGnCjBwRmH3adrQCCv3TyM9VbIr1GsOe8c+A5uhza46muNRoQDRuwk1keOXI5 PcvJhb+u4jcBNdK+t8Lj52QK8Q/zIoXLohzWSCJg42D7a2uJwf2v0PkgaD+iJGBTh65N /ZiY3ICDjZHaVgTjPTOGQ/sdV+KSkKhp6NsgBTKb/4xDBGR08vuiCxH988Ue9goEqo1i kUjOFLwPMEsGV3qr8rcbRIZcyQywLe3kgVdrbuminTETPq515LyFmm/vwb76SSFKVcyB 4AwkbdTk1iOCfrKRCRScBFP3L+uBJDrYdFoWjQ6Qcck1aXqXgAvW5/gmEh9HOsfpBWAb WZ5w== 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 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k24-20020a63ba18000000b005b90af19430si4976098pgf.595.2023.12.10.15.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 15:38:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 EBC7E808653E; Sun, 10 Dec 2023 15:38:04 -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 <rfc822;hjfbswb@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <soyer@irl.hu> To: Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>, Baojun Xu <baojun.xu@ti.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com> Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Gergo Koteles <soyer@irl.hu>, 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: <f1f6583bda918f78556f67d522ca7b3b91cebbd5.1702251102.git.soyer@irl.hu> 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: <linux-kernel.vger.kernel.org> 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:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784940055800680976 X-GMAIL-MSGID: 1784940055800680976 |
Series |
ALSA: hda/tas2781: handle missing EFI calibration data
|
|
Commit Message
Gergo Koteles
Dec. 10, 2023, 11:37 p.m. UTC
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:
<TASK>
? __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 <soyer@irl.hu>
---
sound/pci/hda/tas2781_hda_i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
base-commit: ffc253263a1375a65fa6c9f62a893e9767fbebfa
Comments
On Mon, 11 Dec 2023 00:37:33 +0100, Gergo Koteles wrote: > > 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: > <TASK> > ? __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 <soyer@irl.hu> Thanks, applied now. Takashi
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;