mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
video: tegra: nvmap: Add more checks to avoid races
Add more checks in nvmap code so as to avoid any possible races. - Update is_nvmap_id_ro and is_nvmap_dmabuf_fd_ro functions so that they return error value during error conditions and also update their callers to handle those error values. - Move all trace statements from end of the function to before handle refcount or dup count is decremented, this make sure we are not dereferencing any freed handle/reference/dambuf. - Increment ref's dup count wherever we feel data race is possible, and decrement it accordingly towards end of function. Bug 4253911 Change-Id: I50fc7cc98ebbf3c50025bc2f9ca32882138fb272 Signed-off-by: Ketan Patil <ketanp@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2972602 Reviewed-by: Sachin Nikam <snikam@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
7a01b01e88
commit
ebf51c43ae
@@ -530,9 +530,9 @@ struct nvmap_handle_ref *nvmap_create_handle_from_va(struct nvmap_client *client
|
||||
struct nvmap_handle_ref *nvmap_dup_handle_ro(struct nvmap_client *client,
|
||||
int fd);
|
||||
|
||||
bool is_nvmap_dmabuf_fd_ro(int fd);
|
||||
int is_nvmap_dmabuf_fd_ro(int fd, bool *is_ro);
|
||||
|
||||
bool is_nvmap_id_ro(struct nvmap_client *client, int id);
|
||||
int is_nvmap_id_ro(struct nvmap_client *client, int id, bool *is_ro);
|
||||
|
||||
struct nvmap_handle_ref *nvmap_duplicate_handle(struct nvmap_client *client,
|
||||
struct nvmap_handle *h, bool skip_val,
|
||||
|
||||
Reference in New Issue
Block a user