From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linfordWu <linfordwu@163.com>
Cc: Johan Hovold <johan@kernel.org>, Alex Elder <elder@kernel.org>,
greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org,
syzbot+61464b62b688791cc24c@syzkaller.appspotmail.com,
syzbot+a2e50fb40695811c2dab@syzkaller.appspotmail.com,
stable@vger.kernel.org
Subject: Re: [PATCH] greybus: operation: fix request timeout race
Date: Sun, 29 Nov 2026 16:45:52 +0100 [thread overview]
Message-ID: <2026112917-armhole-subfloor-6e27@gregkh> (raw)
In-Reply-To: <20261129141123.2172008-1-linfordwu@163.com>
On Sun, Nov 29, 2026 at 10:11:23PM +0800, linfordWu wrote:
> 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.
How was this found and tested?
> 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 <linfordwu@163.com>
Real name please.
> ---
> 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);
why irq? And what about guard()? Did you use a LLM to create this
patch?
thanks,
greg k-h
prev parent reply other threads:[~2026-11-29 15:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 14:11 [PATCH] greybus: operation: fix request timeout race linfordWu
2026-11-29 15:45 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026112917-armhole-subfloor-6e27@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=elder@kernel.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linfordwu@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+61464b62b688791cc24c@syzkaller.appspotmail.com \
--cc=syzbot+a2e50fb40695811c2dab@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox