Skip to content

Commit

Permalink
vcsm: Support for finding user/vc handle in memory pool
Browse files Browse the repository at this point in the history
vmcs_sm_{usr,vc}_handle_from_pid_and_address() were failing to find
handle if specified user pointer is not exactly the one that the memory
locking call returned even if the pointer is in range of map/resource.
So fixed the functions to match the range.

Signed-off-by: Sugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>
  • Loading branch information
Terminus-IMRC authored and popcornmix committed Jan 8, 2018
1 parent df265b5 commit 9f5076a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/char/broadcom/vc_sm/vmcs_sm.c
Expand Up @@ -276,7 +276,10 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid,
/* Lookup the resource. */
if (!list_empty(&sm_state->map_list)) {
list_for_each_entry(map, &sm_state->map_list, map_list) {
if (map->res_pid != pid || map->res_addr != addr)
if (map->res_pid != pid)
continue;
if (!(map->res_addr <= addr &&
addr < map->res_addr + map->resource->res_size))
continue;

pr_debug("[%s]: global map %p (pid %u, addr %lx) -> vc-hdl %x (usr-hdl %x)\n",
Expand Down Expand Up @@ -326,7 +329,10 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid,
/* Lookup the resource. */
if (!list_empty(&sm_state->map_list)) {
list_for_each_entry(map, &sm_state->map_list, map_list) {
if (map->res_pid != pid || map->res_addr != addr)
if (map->res_pid != pid)
continue;
if (!(map->res_addr <= addr &&
addr < map->res_addr + map->resource->res_size))
continue;

pr_debug("[%s]: global map %p (pid %u, addr %lx) -> usr-hdl %x (vc-hdl %x)\n",
Expand Down

0 comments on commit 9f5076a

Please sign in to comment.