if (ref) {
atomic_inc(&ref->pin);
nvmap_handle_get(h[i]);
- } else if (!client->super && (h[i]->owner != client) &&
- !h[i]->global) {
- ret = -EPERM;
} else {
- nvmap_warn(client, "%s pinning unreferenced handle "
- "%p\n", current->group_leader->comm, h[i]);
+ struct nvmap_handle *verify;
+ nvmap_ref_unlock(client);
+ verify = nvmap_validate_get(client, ids[i]);
+ if (verify)
+ nvmap_warn(client, "%s pinning unreferenced "
+ "handle %p\n",
+ current->group_leader->comm, h[i]);
+ else
+ ret = -EPERM;
+ nvmap_ref_lock(client);
}
}
nvmap_ref_unlock(client);
if ((unsigned long)h == id) {
if (client->super || h->global || (h->owner == client))
h = nvmap_handle_get(h);
+ else
+ h = NULL;
spin_unlock(&client->dev->handle_lock);
return h;
}
dev->dev_user.parent = &pdev->dev;
dev->dev_super.minor = MISC_DYNAMIC_MINOR;
- dev->dev_super.name = "kvmap";
- dev->dev_user.fops = &nvmap_super_fops;
- dev->dev_user.parent = &pdev->dev;
+ dev->dev_super.name = "knvmap";
+ dev->dev_super.fops = &nvmap_super_fops;
+ dev->dev_super.parent = &pdev->dev;
dev->handles = RB_ROOT;
}
if (h->flags == NVMAP_HANDLE_UNCACHEABLE ||
- h->flags == NVMAP_HANDLE_WRITE_COMBINE)
+ h->flags == NVMAP_HANDLE_WRITE_COMBINE ||
+ start == end)
goto out;
if (WARN_ON_ONCE(op == NVMAP_CACHE_OP_WB_INV))
return PTR_ERR(pte);
while (count--) {
- if (h_offs + elem_size >= h->size) {
+ if (h_offs + elem_size > h->size) {
nvmap_warn(client, "read/write outside of handle\n");
ret = -EFAULT;
break;