[lvc-project] [PATCH] ALSA: lola: Add a check on the num_pins variable.
Denis Arefev
arefev at swemel.ru
Wed Dec 25 13:17:03 MSK 2024
If num_pins is 0, it will cause division by zero.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev at swemel.ru>
---
sound/pci/lola/lola.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
index 1aa30e90b86a..f73a609a140e 100644
--- a/sound/pci/lola/lola.c
+++ b/sound/pci/lola/lola.c
@@ -468,7 +468,8 @@ static int lola_parse_tree(struct lola *chip)
chip->pin[CAPT].num_pins, chip->pin[PLAY].num_pins);
if (chip->pin[CAPT].num_pins > MAX_AUDIO_INOUT_COUNT ||
- chip->pin[PLAY].num_pins > MAX_AUDIO_INOUT_COUNT) {
+ chip->pin[PLAY].num_pins > MAX_AUDIO_INOUT_COUNT ||
+ !(chip->pin[CAPT].num_pins && chip->pin[PLAY].num_pins)) {
dev_err(chip->card->dev, "Invalid Lola-spec caps 0x%x\n", val);
return -EINVAL;
}
--
2.43.0
More information about the lvc-project
mailing list