Commit fee187fe authored by Oded Gabbay's avatar Oded Gabbay

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: default avatarOded Gabbay <ogabbay@kernel.org>
parent b1664654
......@@ -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 @@ static int cs_ioctl_reserve_signals(struct hl_fpriv *hpriv,
idr_remove(&mgr->handles, hdl_id);
spin_unlock(&mgr->lock);
free_handle:
kfree(handle);
out:
return rc;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment