From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 639D141737B for ; Mon, 6 Jul 2026 08:50:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783327824; cv=none; b=ROenVjaVHnBc3EIf7oMcPBiCZZT+YxF3k3f+HRIhCT0vushD5SC011K1rPB6rIiV1e9wD6W5DvXhttEXex6N+lbjkpfPOcn3ip7YqMRlX848jw/qeyIiPv+NTZhAjDLxQtyB+4QpgfnzFhHERC5IOhb1oHQE7zZjxMgZnZqc7ME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783327824; c=relaxed/simple; bh=LmoWN9cJOdOtpu+/xkWYYz657EPQQE2dbxxqC3LCbZs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SHfMDwJ8YeGxY9IoeAvU00MbEBkJhq/hYjppgunsUQfNipRk8QYbu+HDNscTh9Zbb7H1+4zNoCMzZ2s6ee4zc69+QuRmoQWo5Lsvqy9FThGS/V89MD/sWFFta7BUyJsGAOtFBG7xzUqA/QXUO1yF9L0mNzA3Kj2oz9XGExqyEDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U3aQxJ49; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U3aQxJ49" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-84536ecfc5bso2765674b3a.2 for ; Mon, 06 Jul 2026 01:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783327812; x=1783932612; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=H4l4MHqh/KDadKmP3mSxP41WnIPSqSqdoLG0zsYCrnU=; b=U3aQxJ49Yz+U9z0bmH/E2t43FZwnYRIcotcK7RGHwn54UtCYnsLsht9FnoFXJrcbG0 vRD/awYZYqWRTBmUHay3RilQHXFuoP/PTNc8zwHHDBLZJgPJP36StCLjspB8rKyQNwEL 7q9uq9ShB3Lp5DdQ3v0PXs++qXge6WxPMGGUdPYbW4ne4FAR+tAPvDe7pRqj5wQ8sJO/ oktdLulOyUK1hN4/V26LLivoJOce9QHJEcV5eh+vev3Ng2pmpJ6VetdYrpBdBDXS2SE3 JuGxDqlPrP/ewVLFNzxJXNpWLTW+Zyu2hr2a3ZOWZCC2BoegeBQGxito4OJ+UYtPBtCd aXAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783327812; x=1783932612; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=H4l4MHqh/KDadKmP3mSxP41WnIPSqSqdoLG0zsYCrnU=; b=HuR5Xj50rFm8qloo0A34lAT7+7RQHKqF+RV+n0TvCMcHNAZWYqyIlfVlRE1Kayrz5y xGsPABzcpqC34N5uYD6gwBLyxA3uLYH+EWhGzwKXza9kV99qYf5rw9bsT9lQu03bBYv9 HdNhHxn1DQD2oxPTsXGtmbVtFp+3NZx2e+RZ+E7H/tnHEn9r199qBnAgTDUWCwgdtlg6 ZksEbvB3mazjtUJ5NogQQD/1+UqW2degmA4HWPuZmnbYvoxPr/Oh5Qa2dAyB9+3oxHEV mNCBftX8xTYEHAA1ZR8BLLuwUulNe+TdNALpvzUJdCTGVfU4ny19niasLRKQe/IdZZx8 XM6Q== X-Forwarded-Encrypted: i=1; AHgh+RoOnZkVqli/mqyFUeCNOh0qRUICVg+lNcjzIZO0kEKewdYJlP85JpKcmDLnHFaqB1c+LSz1UBOt3M22Scw=@vger.kernel.org X-Gm-Message-State: AOJu0YxeRs9Hc3V86Z4LRxjuqDWQHi5eVhVoGmdXJriCSp3Z2duBDFuC XClB+5wGuxXm6AzuDnxSUDZnTncQmPRrFxnWEFTJMt8vL2MBZC7OCezJ X-Gm-Gg: AfdE7cnYT1tAtzSgi8GkiiTJoIZpEZNU/p0kTRL2RTu4FqdtmGG1Bz/vsIV9eaCw6fK zDpv3XhQ+QxYrxypQGilhxuqONk/FlI4WEAehm20xpV0ZPTETmZYH3cLBk1w+yX0LDjvuAr78Zy /h56d3L7NTiWcgTnf9uts1rdVvroMYJFNZhJg65GUtltfSVqq+pA50mgVh8Jl68hHkJPZ6tnRme XvW4Jo8FSJF0dPaiVA1B39sjSeOAfFDcpnUQlAxdBJ1PmgyfuctAai/oair7rNS5I3XHMBkCkKF 1y2TECct8HF7J7FkkRdQbwBEWT7Dyjb0fUr0iPaZQMQsPQTeTNOJrqsJMNpkssnNmUNs18G4V4n KG+Vpj7If7msIoqai16P5KLeVF6d/Ew5XMRMb15856A7KhIf1rM53BXSmKGSjHVvMyfA6+ta86K BLMfxf1c2ViDiZiatXOxR3Coq9va8NgzrE68roZuKwppCmgX0= X-Received: by 2002:a05:6a00:2d1f:b0:845:e717:ecf with SMTP id d2e1a72fcca58-847f6f0041dmr8318806b3a.36.1783327810779; Mon, 06 Jul 2026 01:50:10 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d7c142sm3422924b3a.45.2026.07.06.01.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 01:50:10 -0700 (PDT) From: phucduc.bui@gmail.com To: Cezary Rojewski , Jaroslav Kysela , Takashi Iwai , cassiogabrielcontato@gmail.com Cc: Kees Cook , Dan Carpenter , Cen Zhang , Len Bao , Mehul Rao , Sebastian Andrzej Siewior , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, bui duc phuc Subject: [PATCH 1/6] ALSA: control: Return -ENODEV instead of -EFAULT in snd_ctl_open() Date: Mon, 6 Jul 2026 15:49:45 +0700 Message-ID: <20260706084950.49331-2-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260706084950.49331-1-phucduc.bui@gmail.com> References: <20260706084950.49331-1-phucduc.bui@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: bui duc phuc When try_module_get() fails in snd_ctl_open(), the owning module is going away and the device is no longer usable, so -EFAULT ("bad address") is the wrong error. Return -ENODEV, matching the other unavailable-device paths in this function(the NULL card check and the snd_card_file_add() failure). This changes the errno reported to userspace on this rare race. No other behaviour changes. Signed-off-by: bui duc phuc --- sound/core/control.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/core/control.c b/sound/core/control.c index 037e455bb11b..f64b2dec746a 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -64,11 +64,10 @@ static int snd_ctl_open(struct inode *inode, struct file *file) } err = snd_card_file_add(card, file); if (err < 0) { - err = -ENODEV; goto __error1; } if (!try_module_get(card->module)) { - err = -EFAULT; + err = -ENODEV; goto __error2; } ctl = kzalloc(sizeof(*ctl), GFP_KERNEL); -- 2.43.0