Skip to content

Commit 6664d16

Browse files
author
Mika Penttilä
committed
gpu: host1x: Plug potential memory leak
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2154295 Upstream Status: v5.15-rc4 commit c3dbfb9 Author: Thierry Reding <treding@nvidia.com> AuthorDate: Thu Sep 2 22:33:09 2021 +0200 Commit: Thierry Reding <treding@nvidia.com> CommitDate: Thu Sep 16 18:06:52 2021 +0200 The memory allocated for a DMA fence could be leaked if the code failed to allocate the waiter object. Make sure to release the fence allocation on failure. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Mika Penttilä <mpenttil@redhat.com>
1 parent d313c0b commit 6664d16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/host1x/fence.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ struct dma_fence *host1x_fence_create(struct host1x_syncpt *sp, u32 threshold)
152152
return ERR_PTR(-ENOMEM);
153153

154154
fence->waiter = kzalloc(sizeof(*fence->waiter), GFP_KERNEL);
155-
if (!fence->waiter)
155+
if (!fence->waiter) {
156+
kfree(fence);
156157
return ERR_PTR(-ENOMEM);
158+
}
157159

158160
fence->sp = sp;
159161
fence->threshold = threshold;

0 commit comments

Comments
 (0)