summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorOded Gabbay <ogabbay@kernel.org>2021-11-30 15:54:53 +0300
committerOded Gabbay <ogabbay@kernel.org>2021-12-26 09:59:08 +0300
commitfee187fe460b6b72a62e7d7b7193f8d675752544 (patch)
treef9acb1c41b14f73ee58c4b2c5cfde5d3df9e3296 /drivers/misc
parentb166465452ac27415bc747c4c47c96d1314d06f1 (diff)
downloadlinux-fee187fe460b6b72a62e7d7b7193f8d675752544.tar.xz
habanalabs: free signal handle on failure
Fix a bug where in case of failure to allocate idr, the handle's memory wasn't freed as part of the error handling code. Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/habanalabs/common/command_submission.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c
index 8be547b0926c..d169418197c0 100644
--- a/drivers/misc/habanalabs/common/command_submission.c
+++ b/drivers/misc/habanalabs/common/command_submission.c
@@ -1838,7 +1838,7 @@ static int cs_ioctl_reserve_signals(struct hl_fpriv *hpriv,
if (hdl_id < 0) {
dev_err(hdev->dev, "Failed to allocate IDR for a new signal reservation\n");
rc = -EINVAL;
- goto out;
+ goto free_handle;
}
handle->id = hdl_id;
@@ -1891,7 +1891,9 @@ remove_idr:
idr_remove(&mgr->handles, hdl_id);
spin_unlock(&mgr->lock);
+free_handle:
kfree(handle);
+
out:
return rc;
}