mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
memstick: Add timeout to prevent indefinite waiting
[ Upstream commit b65e630a55a490a0269ab1e4a282af975848064c ] Add timeout handling to wait_for_completion calls in memstick_set_rw_addr() and memstick_alloc_card() to prevent indefinite blocking in case of hardware or communication failures. Signed-off-by: Jiayi Li <lijiayi@kylinos.cn> Link: https://lore.kernel.org/r/20250804024825.1565078-1-lijiayi@kylinos.cn Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a83b52e693
commit
0e2e0078da
1 changed files with 6 additions and 2 deletions
|
|
@ -369,7 +369,9 @@ int memstick_set_rw_addr(struct memstick_dev *card)
|
|||
{
|
||||
card->next_request = h_memstick_set_rw_addr;
|
||||
memstick_new_req(card->host);
|
||||
wait_for_completion(&card->mrq_complete);
|
||||
if (!wait_for_completion_timeout(&card->mrq_complete,
|
||||
msecs_to_jiffies(500)))
|
||||
card->current_mrq.error = -ETIMEDOUT;
|
||||
|
||||
return card->current_mrq.error;
|
||||
}
|
||||
|
|
@ -403,7 +405,9 @@ static struct memstick_dev *memstick_alloc_card(struct memstick_host *host)
|
|||
|
||||
card->next_request = h_memstick_read_dev_id;
|
||||
memstick_new_req(host);
|
||||
wait_for_completion(&card->mrq_complete);
|
||||
if (!wait_for_completion_timeout(&card->mrq_complete,
|
||||
msecs_to_jiffies(500)))
|
||||
card->current_mrq.error = -ETIMEDOUT;
|
||||
|
||||
if (card->current_mrq.error)
|
||||
goto err_out;
|
||||
|
|
|
|||
Loading…
Reference in a new issue