2019-03-29 14:12:17 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-10-16 02:05:43 +08:00
|
|
|
From: Jayachandran B <jayachandran.b@intel.com>
|
|
|
|
Date: Tue, 14 Jun 2016 10:39:48 +0530
|
2019-03-29 14:12:17 +08:00
|
|
|
Subject: [PATCH] ASoC: Intel: Skylake: Probe-Limit the bytes to copy
|
2018-10-16 02:05:43 +08:00
|
|
|
|
|
|
|
If userspace happens to issue a copy with count > ring buffer size,
|
|
|
|
limit the count to the allocated ring buffer size to avoid out of
|
|
|
|
bound access into the buffer.
|
|
|
|
|
|
|
|
Change-Id: I7acbfb64bda299237a9d56bbac4a022d36b28bfd
|
|
|
|
Signed-off-by: Jayachandran B <jayachandran.b@intel.com>
|
|
|
|
Reviewed-on:
|
|
|
|
Reviewed-by: Babu, Ramesh <ramesh.babu@intel.com>
|
|
|
|
Tested-by: Babu, Ramesh <ramesh.babu@intel.com>
|
|
|
|
---
|
|
|
|
sound/soc/intel/skylake/skl-probe.c | 6 ++++++
|
|
|
|
1 file changed, 6 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/sound/soc/intel/skylake/skl-probe.c b/sound/soc/intel/skylake/skl-probe.c
|
2020-10-27 02:14:06 +08:00
|
|
|
index 7d2379806daf..507513eabbd6 100644
|
2018-10-16 02:05:43 +08:00
|
|
|
--- a/sound/soc/intel/skylake/skl-probe.c
|
|
|
|
+++ b/sound/soc/intel/skylake/skl-probe.c
|
|
|
|
@@ -230,6 +230,12 @@ int skl_probe_compr_copy(struct snd_compr_stream *stream, char __user *buf,
|
|
|
|
{
|
|
|
|
int offset = 0, availcount = 0, retval = 0, copy;
|
|
|
|
void *dstn;
|
|
|
|
+ /*
|
|
|
|
+ * If userspace happens to issue a copy with count > ring buffer size,
|
|
|
|
+ * limit the count to the allocated ring buffer size.
|
|
|
|
+ */
|
|
|
|
+ if (count > stream->runtime->buffer_size)
|
|
|
|
+ count = stream->runtime->buffer_size;
|
|
|
|
|
|
|
|
if (stream->direction == SND_COMPRESS_CAPTURE) {
|
|
|
|
offset = stream->runtime->total_bytes_transferred %
|
|
|
|
--
|
2019-04-08 18:08:36 +08:00
|
|
|
https://clearlinux.org
|
2018-10-16 02:05:43 +08:00
|
|
|
|