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

Commit 9d64690a authored by Bhalchandra Gajare's avatar Bhalchandra Gajare Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm-lsm-client: Fix possible null pointer dereference



During handling the lsm event, the event status is re-allocated based
on the payload size. Add null check on this allocation to avoid
possible null pointer de-reference.

CRs-fixed: 836640
Change-Id: Id6fb665bd5a73a2fc55d8c5c23b6c72d6101a4cb
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent 4c47f344
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -277,6 +277,12 @@ static void lsm_event_handler(uint32_t opcode, uint32_t token,
		prtd->event_status = krealloc(prtd->event_status,
					sizeof(struct snd_lsm_event_status) +
					payload_size, GFP_ATOMIC);
		if (!prtd->event_status) {
			dev_err(rtd->dev, "%s: no memory for event status\n",
				__func__);
			return;
		}

		prtd->event_status->status = status;
		prtd->event_status->payload_size = payload_size;
		if (likely(prtd->event_status)) {