Commit 6c780617 authored by Colin Ian King's avatar Colin Ian King
Browse files

vcsm: increment res_stats MAP_FAIL stats before we potentially release the resource



resource can be kfree'd when the reference count is zero, so we should
not bump the res_stats of the resource after the vmcs_sm_release_resource
call since the resource may have been kfree'd by this call. Instead, bump
the stats before we call vmcs_sm_release_resource to avoid a potential
NULL pointer derefernce.

Bug found using cppcheck static analysis:

[drivers/char/broadcom/vc_sm/vmcs_sm.c:1373]: (error) Dereferencing
  'resource' after it is deallocated / released

Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
parent 38c57491
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment