From patchwork Fri Mar 21 18:27:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Nepomnyashih X-Patchwork-Id: 876326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CC9DC36008 for ; Wed, 26 Mar 2025 09:11:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [45.14.194.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E01E7601B3; Wed, 26 Mar 2025 10:11:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E01E7601B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1742980292; bh=NnQwNZhrJn0kJOUxGptj8Ywrr5SlWHhb++N9tf5qPV0=; h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=HtXctX9m5YqfE11Nd4bco7RlyCo+lMbI7I6Ahes5/Md4PxkKdqQEZZA1PMOb72OM1 SultmgATLdXupMjNYt47/8qETulmpdyEV0WGGTzHbHnLE3pjSfsp3/f9Lw3NEa0kPq Ltnoq+GStOhU3bHlavJFpBbVfrIKJ9EIG6fnzM7k= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E68B0F805C2; Wed, 26 Mar 2025 10:10:57 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id BA49BF805BA; Wed, 26 Mar 2025 10:10:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D873CF8013D; Fri, 21 Mar 2025 19:27:20 +0100 (CET) Received: from mail.nppct.ru (mail.nppct.ru [195.133.245.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8F3F9F800D2 for ; Fri, 21 Mar 2025 19:27:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8F3F9F800D2 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=nppct.ru header.i=@nppct.ru header.a=rsa-sha256 header.s=dkim header.b=VFhFFPxN Received: from mail.nppct.ru (localhost [127.0.0.1]) by mail.nppct.ru (Postfix) with ESMTP id 1D3881C17A6 for ; Fri, 21 Mar 2025 21:27:16 +0300 (MSK) Authentication-Results: mail.nppct.ru (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=nppct.ru DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nppct.ru; h= content-transfer-encoding:mime-version:x-mailer:message-id:date :date:subject:subject:to:from:from; s=dkim; t=1742581635; x= 1743445636; bh=NnQwNZhrJn0kJOUxGptj8Ywrr5SlWHhb++N9tf5qPV0=; b=V FhFFPxN0iOOYIXzPPmogOULoKLMWG3s+KIRocSY73nJRaPQ+92UXVt7QR4yQOijL LNYMgXZSGTECc8lHtV/0mBhSGv1tkGgMSCumxaCKfOWTSGnK+Euimw3UhjmlJd+M 4JH+75YrJo0dzKIF/K6mrW1SfKrkuekMJKuSBq765g= X-Virus-Scanned: Debian amavisd-new at mail.nppct.ru Received: from mail.nppct.ru ([127.0.0.1]) by mail.nppct.ru (mail.nppct.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id m9x-fwYPZ4B5 for ; Fri, 21 Mar 2025 21:27:15 +0300 (MSK) Received: from localhost.localdomain (unknown [87.249.24.51]) by mail.nppct.ru (Postfix) with ESMTPSA id E0C2B1C16F4; Fri, 21 Mar 2025 21:27:09 +0300 (MSK) From: Alexey Nepomnyashih To: Jaroslav Kysela Cc: Alexey Nepomnyashih , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, syzbot+4e7919b09c67ffd198ae@syzkaller.appspotmail.com, Takashi Iwai Subject: [PATCH 6.1] ALSA: control: Avoid WARN() for symlink errors Date: Fri, 21 Mar 2025 18:27:00 +0000 Message-ID: <20250321182701.1729403-1-sdl@nppct.ru> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-MailFrom: sdl@nppct.ru X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: HNOWTJN7X4B3TQRYWFII3HSF3ETDCKIZ X-Message-ID-Hash: HNOWTJN7X4B3TQRYWFII3HSF3ETDCKIZ X-Mailman-Approved-At: Wed, 26 Mar 2025 09:10:52 +0000 X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Takashi Iwai commit b2e538a9827dd04ab5273bf4be8eb2edb84357b0 upstream. Using WARN() for showing the error of symlink creations don't give more information than telling that something goes wrong, since the usual code path is a lregister callback from each control element creation. More badly, the use of WARN() rather confuses fuzzer as if it were serious issues. This patch downgrades the warning messages to use the normal dev_err() instead of WARN(). For making it clearer, add the function name to the prefix, too. Fixes: a135dfb5de15 ("ALSA: led control - add sysfs kcontrol LED marking layer") Reported-by: syzbot+4e7919b09c67ffd198ae@syzkaller.appspotmail.com Closes: https://lore.kernel.org/675664c7.050a0220.a30f1.018c.GAE@google.com Link: https://patch.msgid.link/20241209095614.4273-1-tiwai@suse.de Signed-off-by: Takashi Iwai [ Alexey Nepomnyashih: changed &card->ctl_dev->kobj to &card->ctl_dev.kobj. ] Signed-off-by: Alexey Nepomnyashih --- sound/core/control_led.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sound/core/control_led.c b/sound/core/control_led.c index 3cadd40100f3..6d81a6a59f29 100644 --- a/sound/core/control_led.c +++ b/sound/core/control_led.c @@ -688,10 +688,16 @@ static void snd_ctl_led_sysfs_add(struct snd_card *card) goto cerr; led->cards[card->number] = led_card; snprintf(link_name, sizeof(link_name), "led-%s", led->name); - WARN(sysfs_create_link(&card->ctl_dev.kobj, &led_card->dev.kobj, link_name), - "can't create symlink to controlC%i device\n", card->number); - WARN(sysfs_create_link(&led_card->dev.kobj, &card->card_dev.kobj, "card"), - "can't create symlink to card%i\n", card->number); + if (sysfs_create_link(&card->ctl_dev.kobj, &led_card->dev.kobj, + link_name)) + dev_err(card->dev, + "%s: can't create symlink to controlC%i device\n", + __func__, card->number); + if (sysfs_create_link(&led_card->dev.kobj, &card->card_dev.kobj, + "card")) + dev_err(card->dev, + "%s: can't create symlink to card%i\n", + __func__, card->number); continue; cerr: