diff mbox series

ALSA: hda: Always check capability at opening a hwdep

Message ID 20241203135248.19840-1-tiwai@suse.de (mailing list archive)
State New
Headers show
Series ALSA: hda: Always check capability at opening a hwdep | expand

Commit Message

Takashi Iwai Dec. 3, 2024, 1:52 p.m. UTC
We have a capability check at hda_hwdep_open(), but it's applied only
conditionally and the check is skipped when CONFIG_SND_DEBUG_VERBOSE
is set.  This is rather inconsistent behavior, and we should apply the
check always no matter which config is chosen.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_hwdep.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Jaroslav Kysela Dec. 3, 2024, 2:17 p.m. UTC | #1
On 03. 12. 24 14:52, Takashi Iwai wrote:
> We have a capability check at hda_hwdep_open(), but it's applied only
> conditionally and the check is skipped when CONFIG_SND_DEBUG_VERBOSE
> is set.  This is rather inconsistent behavior, and we should apply the
> check always no matter which config is chosen.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

It makes sense.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
diff mbox series

Patch

diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index 727f39acedfc..9325e5c3cbe6 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -84,10 +84,8 @@  static int hda_hwdep_ioctl_compat(struct snd_hwdep *hw, struct file *file,
 
 static int hda_hwdep_open(struct snd_hwdep *hw, struct file *file)
 {
-#ifndef CONFIG_SND_DEBUG_VERBOSE
 	if (!capable(CAP_SYS_RAWIO))
 		return -EACCES;
-#endif
 	return 0;
 }