]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
firmware: arm_scmi: Fix timeout checks on polling path
authorCristian Marussi <cristian.marussi@arm.com>
Mon, 10 Mar 2025 17:58:00 +0000 (17:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 May 2025 12:12:13 +0000 (14:12 +0200)
commit2402a3ef9e8c479503569c006e5f0f5859f1e82b
tree3eee37dcf91d27196ce0d3d2a99c31638813f635
parentb38812942556819263256cb77fbdc9eae7aa5b1b
firmware: arm_scmi: Fix timeout checks on polling path

[ Upstream commit c23c03bf1faa1e76be1eba35bad6da6a2a7c95ee ]

Polling mode transactions wait for a reply busy-looping without holding a
spinlock, but currently the timeout checks are based only on elapsed time:
as a result we could hit a false positive whenever our busy-looping thread
is pre-empted and scheduled out for a time greater than the polling
timeout.

Change the checks at the end of the busy-loop to make sure that the polling
wasn't indeed successful or an out-of-order reply caused the polling to be
forcibly terminated.

Fixes: 31d2f803c19c ("firmware: arm_scmi: Add sync_cmds_completed_on_ret transport flag")
Reported-by: Huangjie <huangjie1663@phytium.com.cn>
Closes: https://lore.kernel.org/arm-scmi/20250123083323.2363749-1-jackhuang021@gmail.com/
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Cc: stable@vger.kernel.org # 5.18.x
Message-Id: <20250310175800.1444293-1-cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/arm_scmi/driver.c