From: phucduc.bui@gmail.com
To: Cezary Rojewski <cezary.rojewski@intel.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
cassiogabrielcontato@gmail.com
Cc: Kees Cook <kees@kernel.org>, Dan Carpenter <error27@gmail.com>,
Cen Zhang <zzzccc427@gmail.com>, Len Bao <len.bao@gmx.us>,
Mehul Rao <mehulrao@gmail.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
bui duc phuc <phucduc.bui@gmail.com>
Subject: [PATCH v2 1/6] ALSA: control: Return -ENODEV instead of -EFAULT in snd_ctl_open()
Date: Tue, 7 Jul 2026 15:45:01 +0700 [thread overview]
Message-ID: <20260707084506.718583-2-phucduc.bui@gmail.com> (raw)
In-Reply-To: <20260707084506.718583-1-phucduc.bui@gmail.com>
From: bui duc phuc <phucduc.bui@gmail.com>
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 <phucduc.bui@gmail.com>
---
Changes in v2:
- Drop the unrelated change from this series.
sound/core/control.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/control.c b/sound/core/control.c
index 037e455bb11b..0ca9fff56e51 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -68,7 +68,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
goto __error1;
}
if (!try_module_get(card->module)) {
- err = -EFAULT;
+ err = -ENODEV;
goto __error2;
}
ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
--
2.43.0
next prev parent reply other threads:[~2026-07-07 8:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 8:45 [PATCH v2 0/6] ALSA: Return -ENODEV instead of -EFAULT on module-get failure phucduc.bui
2026-07-07 8:45 ` phucduc.bui [this message]
2026-07-07 8:45 ` [PATCH v2 2/6] ALSA: hwdep: Return -ENODEV instead of -EFAULT in snd_hwdep_open() phucduc.bui
2026-07-07 8:45 ` [PATCH v2 3/6] ALSA: info: Return -ENODEV instead of -EFAULT in alloc_info_private() phucduc.bui
2026-07-07 8:45 ` [PATCH v2 4/6] ALSA: mixer: oss: Return -ENODEV instead of -EFAULT in snd_mixer_oss_open() phucduc.bui
2026-07-07 8:45 ` [PATCH v2 5/6] ALSA: pcm: oss: Return -ENODEV instead of -EFAULT in snd_pcm_oss_open() phucduc.bui
2026-07-07 8:45 ` [PATCH v2 6/6] ALSA: pcm: Return -ENODEV instead of -EFAULT in snd_pcm_open() phucduc.bui
2026-07-07 9:30 ` [PATCH v2 0/6] ALSA: Return -ENODEV instead of -EFAULT on module-get failure Cezary Rojewski
2026-07-08 10:45 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260707084506.718583-2-phucduc.bui@gmail.com \
--to=phucduc.bui@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=cassiogabrielcontato@gmail.com \
--cc=cezary.rojewski@intel.com \
--cc=error27@gmail.com \
--cc=kees@kernel.org \
--cc=len.bao@gmx.us \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mehulrao@gmail.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=zzzccc427@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.