Skip to content

Commit 17fc1b7

Browse files
committed
Revert "FROMLIST: misc: fastrpc: Remove buffer from list prior to unmap operation"
This change corresponds to the v4 version shared with the upstream community. Revert it to apply the complete v6 revision, which includes additional fixes and updates not present in the earlier version. This reverts commit cd522d4. Signed-off-by: Vinayak Katoch <vkatoch@qti.qualcomm.com>
1 parent c797ce5 commit 17fc1b7

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

drivers/misc/fastrpc.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,6 +2050,9 @@ static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, struct fastrpc_buf *
20502050
&args[0]);
20512051
if (!err) {
20522052
dev_dbg(dev, "unmmap\tpt 0x%09lx OK\n", buf->raddr);
2053+
spin_lock(&fl->lock);
2054+
list_del(&buf->node);
2055+
spin_unlock(&fl->lock);
20532056
fastrpc_buf_free(buf);
20542057
} else {
20552058
dev_err(dev, "unmmap\tpt 0x%09lx ERROR\n", buf->raddr);
@@ -2063,15 +2066,13 @@ static int fastrpc_req_munmap(struct fastrpc_user *fl, char __user *argp)
20632066
struct fastrpc_buf *buf = NULL, *iter, *b;
20642067
struct fastrpc_req_munmap req;
20652068
struct device *dev = fl->sctx->dev;
2066-
int err;
20672069

20682070
if (copy_from_user(&req, argp, sizeof(req)))
20692071
return -EFAULT;
20702072

20712073
spin_lock(&fl->lock);
20722074
list_for_each_entry_safe(iter, b, &fl->mmaps, node) {
20732075
if ((iter->raddr == req.vaddrout) && (iter->size == req.size)) {
2074-
list_del(&iter->node);
20752076
buf = iter;
20762077
break;
20772078
}
@@ -2084,14 +2085,7 @@ static int fastrpc_req_munmap(struct fastrpc_user *fl, char __user *argp)
20842085
return -EINVAL;
20852086
}
20862087

2087-
err = fastrpc_req_munmap_impl(fl, buf);
2088-
if (err) {
2089-
spin_lock(&fl->lock);
2090-
list_add_tail(&buf->node, &fl->mmaps);
2091-
spin_unlock(&fl->lock);
2092-
}
2093-
2094-
return err;
2088+
return fastrpc_req_munmap_impl(fl, buf);
20952089
}
20962090

20972091
static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
@@ -2182,17 +2176,14 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
21822176

21832177
if (copy_to_user((void __user *)argp, &req, sizeof(req))) {
21842178
err = -EFAULT;
2185-
goto err_copy;
2179+
goto err_assign;
21862180
}
21872181

21882182
dev_dbg(dev, "mmap\t\tpt 0x%09lx OK [len 0x%08llx]\n",
21892183
buf->raddr, buf->size);
21902184

21912185
return 0;
2192-
err_copy:
2193-
spin_lock(&fl->lock);
2194-
list_del(&buf->node);
2195-
spin_unlock(&fl->lock);
2186+
21962187
err_assign:
21972188
fastrpc_req_munmap_impl(fl, buf);
21982189

0 commit comments

Comments
 (0)