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

Commit 2c81516a authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

msm: ADSPRPC: Copy entire non-ion buffers



Make sure that the entire input buffer gets copied always to account
for cases where the output buffer could overlap the input buffer.

Change-Id: I8d63ff8c8ebd6f11b71f75112cb48bf095614bfc
Acked-by: default avatarSathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 3a82db8d
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -883,25 +883,24 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx,
		if (err)
			goto bail;
		list[i].num = 1;
		rpra[i].buf.pv = args - ctx->overps[oix]->offset;
		pages[list[i].pgidx].addr =
			buf_page_start((void *)((uintptr_t)pbuf->phys -
						ctx->overps[oix]->offset +
						 (pbuf->size - rlen)));
		pages[list[i].pgidx].size =
			buf_page_size(pra[i].buf.len);
		if (i < inbufs && mlen) {
		pages[list[i].pgidx].size = buf_num_pages(rpra[i].buf.pv,
						rpra[i].buf.len) * PAGE_SIZE;
		if (i < inbufs) {
			if (!kernel) {
				VERIFY(err, 0 == copy_from_user(args,
					(void *)ctx->overps[oix]->mstart,
					mlen));
				VERIFY(err, 0 == copy_from_user(rpra[i].buf.pv,
					pra[i].buf.pv, pra[i].buf.len));
				if (err)
					goto bail;
			} else {
				memmove(args, (void *)ctx->overps[oix]->mstart,
					mlen);
				memmove(rpra[i].buf.pv, pra[i].buf.pv,
					pra[i].buf.len);
			}
		}
		rpra[i].buf.pv = args - ctx->overps[oix]->offset;
		args = (void *)((uintptr_t)args + mlen);
		rlen -= mlen;
	}