[alsa-devel] [PATCH 5/5] UCM: snd_use_case_get: Don't segfault when no current verb

Stephen Warren swarren at nvidia.com
Fri Jun 3 22:56:34 CEST 2011


get_value, called by snd_use_case_get, uses uc_mgr->active_verb without
checking there is one, and hence can segfault. Fix this.

Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
 src/ucm/main.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/ucm/main.c b/src/ucm/main.c
index db71f03..13ea1ed 100644
--- a/src/ucm/main.c
+++ b/src/ucm/main.c
@@ -1180,6 +1180,9 @@ static int get_value(snd_use_case_mgr_t *uc_mgr,
 	struct use_case_device *dev;
 	int err;
 
+	if (!uc_mgr->active_verb)
+		return -ENOENT;
+
 	if (item != NULL) {
 		mod = find_modifier(uc_mgr, uc_mgr->active_verb, item, 0);
 		if (mod != NULL) {
-- 
1.7.0.4



More information about the Alsa-devel mailing list