Skip to content

Commit cc6eeaa

Browse files
sudeep-hollaJassiBrar
authored andcommitted
mailbox: skip complete wait event if timer expired
If a wait_for_completion_timeout() call returns due to a timeout, complete() can get called after returning from the wait which is incorrect and can cause subsequent transmissions on a channel to fail. Since the wait_for_completion_timeout() sees the completion variable is non-zero caused by the erroneous/spurious complete() call, and it immediately returns without waiting for the time as expected by the client. This patch fixes the issue by skipping complete() call for the timer expiry. Fixes: 2b6d83e ("mailbox: Introduce framework for mailbox") Reported-by: Alexey Klimov <[email protected]> Signed-off-by: Sudeep Holla <[email protected]> Signed-off-by: Jassi Brar <[email protected]>
1 parent c61b781 commit cc6eeaa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/mailbox/mailbox.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static void tx_tick(struct mbox_chan *chan, int r)
107107
if (mssg && chan->cl->tx_done)
108108
chan->cl->tx_done(chan->cl, mssg, r);
109109

110-
if (chan->cl->tx_block)
110+
if (r != -ETIME && chan->cl->tx_block)
111111
complete(&chan->tx_complete);
112112
}
113113

@@ -271,8 +271,8 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)
271271

272272
ret = wait_for_completion_timeout(&chan->tx_complete, wait);
273273
if (ret == 0) {
274-
t = -EIO;
275-
tx_tick(chan, -EIO);
274+
t = -ETIME;
275+
tx_tick(chan, t);
276276
}
277277
}
278278

0 commit comments

Comments
 (0)