From b45f4e8d787cfc667d38658da1b7ffb05c8b78a7 Mon Sep 17 00:00:00 2001 From: bui duc phuc Date: Tue, 7 Jul 2026 15:45:01 +0700 Subject: ALSA: control: Return -ENODEV instead of -EFAULT in snd_ctl_open() 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 Reviewed-by: Cezary Rojewski Signed-off-by: Takashi Iwai Link: https://patch.msgid.link/20260707084506.718583-2-phucduc.bui@gmail.com --- 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); -- cgit v1.2.3