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=1794585566; b=2PGZbAUojKbgTJH6Lr2oLUFkGhOBU4CJIyopI8o6NwNjGQoh6373DUr5KDVXgiPrPqd/ xdNCwwT38A/Ryp773myylXleKQ4bPMOSmpUHmyEF9tyztRklRE7sc7q8RHHv7+0tmQxeE YSroCGUrv3EGMC0jKRMK2oAFMPY9rc1KZ0EOC1lWc14tdo38+Tn0UgsJ8hX3X9/WZDc0c iI9ZKJqyiqB92Xq1hbgFgeXla6q0nzZO2mDaFQngjENPjsh6wIR6SHCcLDvoSaA14xz90 ZmFzhXoQdpIZ6k8A0lIXp8IzROzVYgW6DEnt1Q+ITaRRSCzfV48CAlAzaYwDj5prqPA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794585566; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=mVHrEHdyHZbBx6mjGsQ0jTS5iHjYy4zzwMTMz3sex1U=; b=2LYQ0do1iNKxdLPBe7IdmuRCof1DMbc+GDmtIsqQfoVk2CIYj9Oxs3MYRlJBm+l+EbjX x1uf4746c3MZI011UpgSkxU8/PAvBjeoYZd0lIhBPcthyU7VM2T1LGl5kvxZU25WjvC9V Cyk6ix7dD9FsmRSSadzGHitHATgs3sv4GTHjPzpRUSRnLbFBwx3QFaZ1MHpGfE+xbtY3b Ioi6+QPsQGXamO+aGG9V1ok5vkA+aC2DP1ksveQnyH4CGGsIWtwB2SajFAzCvL5cELhsn 4YRQXv4GbqURxnYcr8jm60D8YjHU/48Gl/rKB1aca06LTL3U8sBN/xXswMeH+q/j8mQ== 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=trnF7eUb; 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 C769F606BA88; Fri, 13 Nov 2026 15:59:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=trnF7eUb Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7329F1F000C4; Fri, 13 Nov 2026 15:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1794585566; bh=mVHrEHdyHZbBx6mjGsQ0jTS5iHjYy4zzwMTMz3sex1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=trnF7eUbmmJTG/CTKt98fDvPTj8s3E4kWKZhGnkkgSysl0XlJcoGIt1BjxNtd3mpz W+xsnIvK/8xw3swvqARpczZqSyP+hNG4IdEnvw+sdTj5NvhKzx8FJ4gX9X2aJOrpz7 cLFM8BJnX8bjsNcR0GFlq7hwH6BlvuwkX1SIxLak= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joonhoe Kim <26rote@gmail.com>, Paolo Abeni , Sasha Levin , Filippo Falezza Subject: [PATCH 7.3 202/507] net: qrtr: announce local services again once our HELLO is sent Date: Fri, 13 Nov 2026 10:48:26 -0500 Message-ID: <20261113153801.326492953@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261113153753.358973689@linuxfoundation.org> References: <20261113153753.358973689@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Joonhoe Kim <26rote@gmail.com> [ Upstream commit 743b5c86276b1c3241e6f0f395b55f98f0756ef0 ] Since commit 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register"), qrtr_node_enqueue() drops every packet but HELLO with -EAGAIN until our HELLO has gone out to the node. When the remote's HELLO arrives first, the NEW_SERVER replies from the name service are dropped, and so are the broadcasts for services registered before our HELLO goes out. Nothing announces these services again, so the remote never learns about them. On Kaanapali the modem sends its HELLO before it accepts ours. With rmtfs started first, the modem never learns about rmtfs and its watchdog resets the SoC about 40 s later. Remember that the remote has sent a HELLO. Once our HELLO has been sent to such a node, pass a HELLO from it to the local name service again, so that it announces the services it has at that point. Retry the replay if it cannot be queued, and queue it under ep_lock only while the endpoint is registered, so that it cannot follow the BYE from qrtr_endpoint_unregister(). The flag is not cleared when qrtr_endpoint_hello() restarts the handshake on resume, so a HELLO that the remote sent before then is not lost. The cost is that the remote gets the same NEW_SERVER announcements twice when its HELLO arrives before ours goes out but the name service handles it after, and on every resume. Fixes: 544d85de4dc2 ("net: qrtr: Send HELLO message on endpoint register") Cc: stable@vger.kernel.org Tested-by: Filippo Falezza # Motorola Moto G 5G Plus nairo (SM7250) Signed-off-by: Joonhoe Kim <26rote@gmail.com> Link: https://patch.msgid.link/20261029105142.2503-1-26rote@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/qrtr/af_qrtr.c | 53 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c index e7b3647424b8f..45cb8e8c36ca2 100644 --- a/net/qrtr/af_qrtr.c +++ b/net/qrtr/af_qrtr.c @@ -122,6 +122,7 @@ static DEFINE_XARRAY_ALLOC(qrtr_ports); * @qrtr_tx_flow: xarray of qrtr_tx_flow, keyed by node << 32 | port * @qrtr_tx_lock: lock for qrtr_tx_flow inserts * @hello_sent: hello packet send successful + * @hello_rcvd: remote has sent a hello packet * @rx_queue: receive queue * @item: list item for broadcast list * @say_hello: delayed work for sending hello packet @@ -136,6 +137,7 @@ struct qrtr_node { struct mutex qrtr_tx_lock; /* for qrtr_tx_flow */ bool hello_sent; + bool hello_rcvd; struct sk_buff_head rx_queue; struct list_head item; @@ -541,6 +543,11 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) qrtr_node_assign(node, le32_to_cpu(pkt->server.node)); } + if (cb->type == QRTR_TYPE_HELLO) { + /* Pairs with smp_load_acquire() in qrtr_hello_work() */ + smp_store_release(&node->hello_rcvd, true); + } + if (cb->type == QRTR_TYPE_RESUME_TX) { qrtr_tx_resume(node, skb); } else { @@ -599,6 +606,8 @@ static void qrtr_hello_work(struct work_struct *work) struct qrtr_node *node; struct qrtr_sock *ctrl; struct sk_buff *skb; + bool hello_sent; + int rc = 0; node = container_of(to_delayed_work(work), struct qrtr_node, say_hello); @@ -609,17 +618,45 @@ static void qrtr_hello_work(struct work_struct *work) return; } - skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL); - if (!skb) { - qrtr_port_put(ctrl); - schedule_delayed_work(&node->say_hello, msecs_to_jiffies(100)); - return; + mutex_lock(&node->ep_lock); + hello_sent = node->hello_sent; + mutex_unlock(&node->ep_lock); + + from.sq_node = qrtr_local_nid; + if (!hello_sent) { + skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL); + if (!skb) + goto retry; + + pkt->cmd = cpu_to_le32(QRTR_TYPE_HELLO); + to.sq_node = node->nid; + if (qrtr_node_enqueue(node, skb, QRTR_TYPE_HELLO, &from, &to)) + goto out; } + /* Pairs with smp_store_release() in qrtr_endpoint_post() */ + if (!smp_load_acquire(&node->hello_rcvd)) + goto out; + + skb = qrtr_alloc_ctrl_packet(&pkt, GFP_KERNEL); + if (!skb) + goto retry; + pkt->cmd = cpu_to_le32(QRTR_TYPE_HELLO); - from.sq_node = qrtr_local_nid; - to.sq_node = node->nid; - qrtr_node_enqueue(node, skb, QRTR_TYPE_HELLO, &from, &to); + to.sq_node = READ_ONCE(node->nid); + + mutex_lock(&node->ep_lock); + if (node->ep) + rc = qrtr_local_enqueue(NULL, skb, QRTR_TYPE_HELLO, &to, &from); + else + kfree_skb(skb); + mutex_unlock(&node->ep_lock); + if (!rc) + goto out; + +retry: + schedule_delayed_work(&node->say_hello, msecs_to_jiffies(100)); +out: qrtr_port_put(ctrl); } -- 2.53.0