[PATCH 3/6] ALSA: info: Return -ENODEV instead of -EFAULT in alloc_info_private()
From: phucduc . bui
Date: Mon Jul 06 2026 - 05:00:18 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
When try_module_get() fails in alloc_info_private(), 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 -ENODEV path in the
same function.
This changes the errno reported to userspace on this rare race.
No other behaviour changes.
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/core/info.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/info.c b/sound/core/info.c
index 54834dbe6b59..3b8ccda04e1a 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -78,7 +78,7 @@ static int alloc_info_private(struct snd_info_entry *entry,
if (!entry || !entry->p)
return -ENODEV;
if (!try_module_get(entry->module))
- return -EFAULT;
+ return -ENODEV;
data = kzalloc_obj(*data);
if (!data) {
module_put(entry->module);
--
2.43.0