Re: [PATCH] fix: accel/habanalabs: hl_cs_signal_sob_wraparound_handler: missing hw_sob_get when need_reset is true and encaps_sig is false
From: WenTao Liang
Date: Sat Jun 27 2026 - 23:52:40 EST
> 2026年6月26日 18:44,WenTao Liang <vulab@xxxxxxxxxxx> 写道:
>
> When other_sob->need_reset is true and encaps_sig is false,
> hw_sob_put(other_sob) decrements the kref to 0, but the matching
> hw_sob_get(other_sob) is skipped because it is inside the encaps_sig
> block. The function returns other_sob with kref=0, causing a subsequent
> kref_put to underflow. Fix by adding hw_sob_get(other_sob) in the else
> branch.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: dadf17abb724 ("habanalabs: add support for encapsulated signals reservation")
> Signed-off-by: WenTao Liang <vulab@xxxxxxxxxxx>
> ---
> drivers/accel/habanalabs/common/command_submission.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/accel/habanalabs/common/command_submission.c b/drivers/accel/habanalabs/common/command_submission.c
> index ba4257bda77b..675301dfc0ef 100644
> --- a/drivers/accel/habanalabs/common/command_submission.c
> +++ b/drivers/accel/habanalabs/common/command_submission.c
> @@ -1860,11 +1860,10 @@ int hl_cs_signal_sob_wraparound_handler(struct hl_device *hdev, u32 q_idx,
> if (other_sob->need_reset)
> hw_sob_put(other_sob);
>
> - if (encaps_sig) {
> + if (encaps_sig)
> /* set reset indication for the sob */
> sob->need_reset = true;
> - hw_sob_get(other_sob);
> - }
> + hw_sob_get(other_sob);
>
> dev_dbg(hdev->dev, "switched to SOB %d, q_idx: %d\n",
> prop->curr_sob_offset, q_idx);
> --
> 2.39.5 (Apple Git-154)
Please ignore this patch. I will resend a proper version after
learning the kernel submission process.
Apologies for the noise.
Best regards,
WenTao Liang