From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795967160; b=T/Y9TnPeNWc82z5WoOSFSANIe91i6sBVwxBJXHfztcRbQmczYNfcDY2Nni9v2HG0zxS3 64sXFUxh06FV5mkf1dRSQKgCXrU3HE7hBQgsgk+1N4HpkZErK/BJW1ceI/c+ZVt65bYty 4Hl0m5oIr7umgAazvP7PEbx764ja6fcimoUTykpG384eJq3DT3jIbnVJLXIlPIkNTFPD0 on09zhCRerCYrqh2amqmFrsgBHYK1QwPGBCKS5o4X8EEXUOHVNoahGwB7CXlGGZRTHlpz V3+17cTR0Uc62uXjJ3eYsF798V5H/BMVE4aRUC07sK5taFRMnwy0d5xXMgm/MrajaAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795967160; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=tHGl6qInV13xch+R7BsW32ACtyi31RryRa6Ns88IaWI=; b=AktXj7FIXOYIuXJ8ednFw/Te8Zwwikp9NFGEl4qRO8FBEz0+r3BES0rRkplgzQ7YuWfb q7S70pQkT00F+TDh4PUklNvSE7EFkxJ7AST14hQjNzMiqdJDqXtlGbwyBB/w28jeV4ZNZ Y2pfXL7YmLVsWJnA908dskz4SU/Rs/mPfEXPlnY6+Dpq6JEeA24sDVoB1H32OmL683Jse 1kdYVcCx8hHFGlZiV8p6qJxeELbgG8nEdn6fNS913GnhXYfFnz1wnqEjq/OVViek8d/l6 zGBpn7qnk8n0NggZQ3sxn4b/53JMPJ7OHvmf4sFiVViCNbUIViCds9aEuyw8aWKyx+Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=j2cb98TA; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67B04606A31C; Sun, 29 Nov 2026 15:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=j2cb98TA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EF8D1F00897; Sun, 29 Nov 2026 15:45:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795967160; bh=tHGl6qInV13xch+R7BsW32ACtyi31RryRa6Ns88IaWI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=j2cb98TAK1z6+jxgT5R1R1d7HVuncpgrw05Ph8RbAdvBun7sZbI9+pZxs7LD6IxbG GJbXFQwcCynVScRdhwT+42QqpICWlx01aLmYlLh08jTFALj6RWPfQeicOdkDaTWlWR kzA/g9uKxdgGTEhH68Jq5qA7fjwOPZdEgxl5Rt3E= Date: Sun, 29 Nov 2026 16:45:52 +0100 From: Greg Kroah-Hartman To: linfordWu Cc: Johan Hovold , Alex Elder , 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 Message-ID: <2026112917-armhole-subfloor-6e27@gregkh> References: <20261129141123.2172008-1-linfordwu@163.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 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