Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8072e94 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: qdsp6v2: validate audio client in callback"

parents 23fe8caa 80ed066c
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -401,6 +401,16 @@ static int q6asm_session_alloc(struct audio_client *ac)
	return -ENOMEM;
}

static bool q6asm_is_valid_audio_client(struct audio_client *ac)
{
	int n;
	for (n = 1; n <= SESSION_MAX; n++) {
		if (session[n] == ac)
			return 1;
	}
	return 0;
}

static void q6asm_session_free(struct audio_client *ac)
{
	pr_debug("%s: sessionid[%d]\n", __func__, ac->session);
@@ -1441,7 +1451,8 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv)
		pr_err("%s: data NULL\n", __func__);
		return -EINVAL;
	}
	if (ac->session <= 0 || ac->session > 8) {
	if (ac->session <= 0 || ac->session > 8 ||
		!q6asm_is_valid_audio_client(ac)) {
		pr_err("%s: Session ID is invalid, session = %d\n", __func__,
			ac->session);
		return -EINVAL;