diff options
author | Tomer Tayar <ttayar@habana.ai> | 2019-08-01 15:57:36 +0200 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@gmail.com> | 2019-08-12 08:00:34 +0200 |
commit | 508c5849c62d009e03f37ad0f556071fac5112f0 (patch) | |
tree | cf830b1f50c6ace76ea924efd2e4b02fd48870eb /drivers/misc/habanalabs/context.c | |
parent | Linux 5.3-rc4 (diff) | |
download | linux-508c5849c62d009e03f37ad0f556071fac5112f0.tar.xz linux-508c5849c62d009e03f37ad0f556071fac5112f0.zip |
habanalabs: Avoid double free in error flow
In case kernel context init fails during device initialization, both
hl_ctx_put() and kfree() are called, ending with a double free of the
kernel context.
Calling kfree() is needed only when a failure happens between the
allocation of the kernel context and its initialization, so move it to
there and remove it from the error flow.
Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Diffstat (limited to 'drivers/misc/habanalabs/context.c')
0 files changed, 0 insertions, 0 deletions