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

Commit 41599f4d authored by Kumar Anurag Singh's avatar Kumar Anurag Singh Committed by Abinath S
Browse files

dsp: q6lsm: Check size of payload before access



check size of payload before access in q6lsm_mmapcallback.

Change-Id: I6a755ca4cf54078f0d00f38e303f1b1da29b244c
Signed-off-by: default avatarKumar Anurag Singh <quic_kumaranu@quicinc.com>
parent 3d5955a2
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2013-2020, Linux Foundation. All rights reserved.
 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
 */
#include <linux/fs.h>
#include <linux/mutex.h>
@@ -2036,6 +2036,12 @@ static int q6lsm_mmapcallback(struct apr_client_data *data, void *priv)
		return 0;
	}

	if (data->payload_size < (2 * sizeof(uint32_t))) {
		pr_err("%s: payload has invalid size[%d]\n", __func__,
			data->payload_size);
		return -EINVAL;
	}

	command = payload[0];
	retcode = payload[1];
	sid = (data->token >> 8) & 0x0F;