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

Commit 24a57d52 authored by Aravind Kumar's avatar Aravind Kumar
Browse files

ASoC: msm: qdsp6v2: avoid null pointer dereference



If memory allocation fails or allocation of extremely
large buffer is attempted causing kmalloc to return a
NULL, the present code goes ahead and dereferences the
NULL pointer.
The change returns from the function immediately if
kmalloc returns a NULL.

CRs-Fixed: 683684
Change-Id: Iffd532b9eacebfc3c365ced6856a117164111988
Signed-off-by: default avatarAravind Kumar <akumark@codeaurora.org>
parent 5df047d2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ static int msm_lsm_ioctl_compat(struct snd_pcm_substream *substream,
		if (!user) {
			pr_err("%s: Allocation failed event status size %d\n",
			__func__, size);
			err = -EFAULT;
			return -EFAULT;
		} else {
			cmd = SNDRV_LSM_EVENT_STATUS;
			user->payload_size = userarg32.payload_size;
@@ -556,7 +556,7 @@ static int msm_lsm_ioctl(struct snd_pcm_substream *substream,
		if (!user) {
			pr_err("%s: Allocation failed event status size %d\n",
			__func__, size);
			err = -EFAULT;
			return -EFAULT;
		} else {
			user->payload_size = userarg.payload_size;
			err = msm_lsm_ioctl_shared(substream, cmd, user);