A request can complete after gb_message_send() returns but before its timeout timer is armed. The completion worker then finds no timer to delete, and the request path can leave an active timer in an operation that is about to be freed. Check the result and arm the timer while holding gb_operations_lock, which also protects result updates. If completion has already happened, leave the timer unarmed. Otherwise the completion worker will delete the armed timer as before. Reported-by: syzbot+61464b62b688791cc24c@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=61464b62b688791cc24c Reported-by: syzbot+a2e50fb40695811c2dab@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=a2e50fb40695811c2dab Fixes: dbec27298b0d ("staging: greybus: operation: add generic timeout support") Link: https://lore.kernel.org/all/20261022134817.1703927-1-hackerowskiy@gmail.com/ Link: https://lore.kernel.org/all/20261103-gb-uart-transport-v5-3-f8e326d6561f@beagleboard.org/ Cc: stable@vger.kernel.org Signed-off-by: linfordWu --- drivers/greybus/operation.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/greybus/operation.c b/drivers/greybus/operation.c index 7e12ffb2dd6..7d4006f4bbd 100644 --- a/drivers/greybus/operation.c +++ b/drivers/greybus/operation.c @@ -725,6 +725,7 @@ int gb_operation_request_send(struct gb_operation *operation, { struct gb_connection *connection = operation->connection; struct gb_operation_msg_hdr *header; + unsigned long flags; unsigned int cycle; int ret; @@ -771,8 +772,12 @@ int gb_operation_request_send(struct gb_operation *operation, goto err_put_active; if (timeout) { - operation->timer.expires = jiffies + msecs_to_jiffies(timeout); - add_timer(&operation->timer); + spin_lock_irqsave(&gb_operations_lock, flags); + if (operation->errno == -EINPROGRESS) { + operation->timer.expires = jiffies + msecs_to_jiffies(timeout); + add_timer(&operation->timer); + } + spin_unlock_irqrestore(&gb_operations_lock, flags); } return 0; -- 2.43.0