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

Commit b8304fb6 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "adsprpc: Allow mapping of buffers with fd value as zero"

parents 4944b485 a7064eb3
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -1167,6 +1167,8 @@ static int context_alloc(struct fastrpc_file *fl, uint32_t kernel,
						bufs * sizeof(*ctx->fds));
		if (err)
			goto bail;
	} else {
		ctx->fds = NULL;
	}
	if (invokefd->attrs) {
		K_COPY_FROM_USER(err, kernel, ctx->attrs, invokefd->attrs,
@@ -1409,7 +1411,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
		size_t len = lpra[i].buf.len;

		mutex_lock(&ctx->fl->map_mutex);
		if (ctx->fds[i] && (ctx->fds[i] != -1))
		if (ctx->fds && (ctx->fds[i] != -1))
			fastrpc_mmap_create(ctx->fl, ctx->fds[i],
					ctx->attrs[i], buf, len,
					mflags, &ctx->maps[i]);
@@ -2067,11 +2069,11 @@ static int fastrpc_init_process(struct fastrpc_file *fl,
		inbuf.pageslen = 1;
		ra[0].buf.pv = (void *)&inbuf;
		ra[0].buf.len = sizeof(inbuf);
		fds[0] = 0;
		fds[0] = -1;

		ra[1].buf.pv = (void *)current->comm;
		ra[1].buf.len = inbuf.namelen;
		fds[1] = 0;
		fds[1] = -1;

		ra[2].buf.pv = (void *)init->file;
		ra[2].buf.len = inbuf.filelen;
@@ -2081,17 +2083,17 @@ static int fastrpc_init_process(struct fastrpc_file *fl,
		pages[0].size = imem->size;
		ra[3].buf.pv = (void *)pages;
		ra[3].buf.len = 1 * sizeof(*pages);
		fds[3] = 0;
		fds[3] = -1;

		inbuf.attrs = uproc->attrs;
		ra[4].buf.pv = (void *)&(inbuf.attrs);
		ra[4].buf.len = sizeof(inbuf.attrs);
		fds[4] = 0;
		fds[4] = -1;

		inbuf.siglen = uproc->siglen;
		ra[5].buf.pv = (void *)&(inbuf.siglen);
		ra[5].buf.len = sizeof(inbuf.siglen);
		fds[5] = 0;
		fds[5] = -1;

		ioctl.inv.handle = FASTRPC_STATIC_HANDLE_PROCESS_GROUP;
		ioctl.inv.sc = REMOTE_SCALARS_MAKE(6, 4, 0);
@@ -2170,18 +2172,18 @@ static int fastrpc_init_process(struct fastrpc_file *fl,

		ra[0].buf.pv = (void *)&inbuf;
		ra[0].buf.len = sizeof(inbuf);
		fds[0] = 0;
		fds[0] = -1;

		ra[1].buf.pv = (void *)proc_name;
		ra[1].buf.len = inbuf.namelen;
		fds[1] = 0;
		fds[1] = -1;

		pages[0].addr = phys;
		pages[0].size = size;

		ra[2].buf.pv = (void *)pages;
		ra[2].buf.len = sizeof(*pages);
		fds[2] = 0;
		fds[2] = -1;
		ioctl.inv.handle = FASTRPC_STATIC_HANDLE_PROCESS_GROUP;

		ioctl.inv.sc = REMOTE_SCALARS_MAKE(8, 3, 0);