Netdev List
 help / color / mirror / Atom feed
From: Sung Byeongchan <tjdqudcks0424@naver.com>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH net] qrtr: make repeated lookups from one client idempotent
Date: Thu,  8 Oct 2026 17:25:18 +0900	[thread overview]
Message-ID: <20261008082518.347350-1-tjdqudcks0424@naver.com> (raw)

The QRTR name service counts every NEW_LOOKUP request as a new global row,
even when one client repeats the same service and instance tuple. An
unprivileged local socket can fill all 128 rows with duplicates and prevent
an independent observer from registering a lookup.

Reuse an existing tuple owned by the same node and port. Continue through
the listing path so a repeated request retains its notification semantics
without consuming another global row.

An isolated AF_QIPCRTR test blocked an independent observer in all three
baseline runs. The observer succeeded in all three patched runs. The
127-row boundary, repeated-listing, and socket-close recovery controls
retained their expected behavior.

The demonstrated impact is bounded local cross-socket service denial. No
memory corruption or privilege escalation was observed.

This change was prepared with assistance from OpenAI Codex. I reviewed the
source change, test results, and this commit message.

Fixes: 5640227d9a21 ("net: qrtr: ns: Limit the maximum number of lookups")
Assisted-by: OpenAI Codex
Signed-off-by: Sung Byeongchan <tjdqudcks0424@naver.com>
---
 net/qrtr/ns.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index bcb090ee79d49..ae0dc2474e5e9 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -547,6 +547,14 @@ static int ctrl_cmd_new_lookup(struct sockaddr_qrtr *from,
 	if (from->sq_node != qrtr_ns.local_node)
 		return -EINVAL;
 
+	list_for_each_entry(lookup, &qrtr_ns.lookups, li) {
+		if (lookup->sq.sq_node == from->sq_node &&
+		    lookup->sq.sq_port == from->sq_port &&
+		    lookup->service == service &&
+		    lookup->instance == instance)
+			goto notify;
+	}
+
 	if (qrtr_ns.lookup_count >= QRTR_NS_MAX_LOOKUPS) {
 		pr_err_ratelimited("QRTR client node exceeds max lookup limit!\n");
 		return -ENOSPC;
@@ -562,6 +570,7 @@ static int ctrl_cmd_new_lookup(struct sockaddr_qrtr *from,
 	list_add_tail(&lookup->li, &qrtr_ns.lookups);
 	qrtr_ns.lookup_count++;
 
+notify:
 	memset(&filter, 0, sizeof(filter));
 	filter.service = service;
 	filter.instance = instance;
-- 
2.43.0


             reply	other threads:[~2026-10-08  8:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  8:25 Sung Byeongchan [this message]
2026-10-08  8:29 ` [PATCH net] qrtr: make repeated lookups from one client idempotent netdev-bot+sinfo
2026-10-08  8:38   ` 성병찬

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=20261008082518.347350-1-tjdqudcks0424@naver.com \
    --to=tjdqudcks0424@naver.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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