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

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

ASoC: msm-cpe-lsm: Fix out of memory on buffer allocation



The buffer used for look-ahead-buffering is allocated during IOCTL from
userspace. It is possible that userspace can invoke this IOCTL multiple
times without invoking the IOCTL to de-allocate the buffer. This results
in out of memory issue for buffer allocation during stress testing. Fix
this issue by avoiding multiple buffer allocations.

CRs-fixed: 942452
Change-Id: Id9eb99dc2c8527fbbe1fe79fca1cdcea232c33da
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent ac6766f8
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -424,6 +424,14 @@ static int msm_cpe_lab_buf_alloc(struct snd_pcm_substream *substream,
	u32 count = 0;
	u32 bufsz, bufcnt;

	if (lab_d->pcm_buf &&
	    lab_d->pcm_buf->mem) {
		dev_dbg(rtd->dev,
			"%s: LAB buf already allocated\n",
			__func__);
		goto exit;
	}

	bufsz = hw_params->buf_sz;
	bufcnt = hw_params->period_count;