Skip to content

Commit a1d6b19

Browse files
tititiou36alexdeucher
authored andcommitted
drm/amdgpu: check memory allocation failure
Check memory allocation failure and return -ENOMEM in such a case. 'num_post_dep_syncobjs' still has to be set to 0 before the test in order to have it initialized if 'amdgpu_cs_parser_fini()' is called to free resources. The calling graph would be, in such a case! failure in amdgpu_cs_process_syncobj_out_dep() ---> error code returned by amdgpu_cs_dependencies() --> amdgpu_cs_parser_fini() is called Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 2959a53 commit a1d6b19

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,9 @@ static int amdgpu_cs_process_syncobj_out_dep(struct amdgpu_cs_parser *p,
10791079
GFP_KERNEL);
10801080
p->num_post_dep_syncobjs = 0;
10811081

1082+
if (!p->post_dep_syncobjs)
1083+
return -ENOMEM;
1084+
10821085
for (i = 0; i < num_deps; ++i) {
10831086
p->post_dep_syncobjs[i] = drm_syncobj_find(p->filp, deps[i].handle);
10841087
if (!p->post_dep_syncobjs[i])

0 commit comments

Comments
 (0)