From d9468d5286c1b6483bcaa0e89d9b2862941f3387 Mon Sep 17 00:00:00 2001 From: bui duc phuc Date: Tue, 7 Jul 2026 15:45:05 +0700 Subject: [PATCH] ALSA: pcm: oss: Return -ENODEV instead of -EFAULT in snd_pcm_oss_open() When try_module_get() fails in snd_pcm_oss_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 pcm check and the card->shutdown check). This changes the errno reported to userspace on this rare race. No other behaviour changes. Signed-off-by: bui duc phuc Reviewed-by: Cezary Rojewski Signed-off-by: Takashi Iwai Link: https://patch.msgid.link/20260707084506.718583-6-phucduc.bui@gmail.com --- sound/core/oss/pcm_oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 0d7818eb3e14..8ae43755fb9b 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -2507,7 +2507,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) if (err < 0) goto __error1; if (!try_module_get(pcm->card->module)) { - err = -EFAULT; + err = -ENODEV; goto __error2; } if (snd_task_name(current, task_name, sizeof(task_name)) < 0) {