Article View: linux.kernel.netdev
Article #20631[PATCH net] rxrpc: Bound the OOB challenge queue per connection
From: Lin Ma
Date: Mon, 23 Nov 2026 01:13
Date: Mon, 23 Nov 2026 01:13
115 lines
12751 bytes
12751 bytes
rxrpc_notify_socket_oob() adds CHALLENGE packets to the owning socket's
recvmsg_oobq without any limit. A peer that keeps sending CHALLENGEs on
an existing connection can therefore grow that queue, and the
pending_oobq tree it feeds, without bound if the socket owner never
reads or responds to them. Each queued skb also holds a reference to
the connection.
A connection cannot make progress until a CHALLENGE is answered, so
there is no point in retaining an arbitrarily deep backlog of them.
Count the outstanding OOB skbs against the connection and drop new
CHALLENGEs once a small limit is reached. The count is dropped when the
skb is finally freed, whether by the userspace response path, the kernel
OOB API or socket teardown.
Dropping the packet consumes it without sending a reject, so a flood
does not abort the connection; if the application cannot keep up, the
existing call and connection timeouts still apply.
Fixes: 5800b1cf3fd8 ("rxrpc: Allow CHALLENGEs to the passed to the app for a RESPONSE")
Signed-off-by: Lin Ma <linma@zju.edu.cn>
---
net/rxrpc/ar-internal.h | 8 ++++++++
net/rxrpc/conn_event.c | 20 ++++++++++++++++----
net/rxrpc/oob.c | 2 ++
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 865f05fe37ab..1eabf1ad5b28 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -534,6 +534,13 @@ struct rxrpc_bundle {
struct rxrpc_connection *conns[4]; /* The connections in the bundle (max 4) */
};
+/*
+ * Maximum number of out-of-band messages that may be queued against a
+ * connection. A connection cannot make progress while a CHALLENGE is
+ * outstanding, so a deeper queue only represents a peer flooding us.
+ */
+#define RXRPC_OOB_MAX_QUEUED 4
+
/*
* RxRPC connection definition
* - matched by { local, peer, epoch, conn_id, direction }
@@ -575,6 +582,7 @@ struct rxrpc_connection {
struct list_head proc_link; /* link in procfs list */
struct list_head link; /* link in master connection list */
struct sk_buff_head rx_queue; /* received conn-level packets */
+ atomic_t n_oobq; /* Number of OOB messages queued */
struct page_frag_cache tx_data_alloc; /* Tx DATA packet allocation */
struct mutex tx_data_alloc_lock;
diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c
index 611c790bc6d0..8665e5f7770d 100644
--- a/net/rxrpc/conn_event.c
+++ b/net/rxrpc/conn_event.c
@@ -436,7 +436,7 @@ static bool rxrpc_post_challenge(struct rxrpc_connection *conn,
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
struct rxrpc_call *call = NULL;
struct rxrpc_sock *rx;
- bool respond = false, queued = false;
+ bool respond = false, queued = false, drop = false;
sp->chall.conn =
rxrpc_get_connection(conn, rxrpc_conn_get_challenge_input);
@@ -471,13 +471,25 @@ static bool rxrpc_post_challenge(struct rxrpc_connection *conn,
return false;
}
- if (call)
- queued = rxrpc_notify_socket_oob(call, skb);
+ if (call) {
+ /* A connection can only make progress by answering one
+ * CHALLENGE at a time, so don't let a peer pile an unbounded
+ * number of them up on the socket queue.
+ */
+ if (atomic_inc_return(&conn->n_oobq) <= RXRPC_OOB_MAX_QUEUED) {
+ queued = rxrpc_notify_socket_oob(call, skb);
+ if (!queued)
+ atomic_dec(&conn->n_oobq);
+ } else {
+ atomic_dec(&conn->n_oobq);
+ drop = true;
+ }
+ }
rcu_read_unlock();
if (call && !queued) {
rxrpc_put_connection(conn, rxrpc_conn_put_challenge_input);
sp->chall.conn = NULL;
- return false;
+ return drop; /* Silently consume a challenge we dropped. */
}
if (!call)
diff --git a/net/rxrpc/oob.c b/net/rxrpc/oob.c
index c80ee2487d09..a126296866fa 100644
--- a/net/rxrpc/oob.c
+++ b/net/rxrpc/oob.c
@@ -215,6 +215,7 @@ static int rxrpc_respond_to_oob(struct rxrpc_sock *rx,
switch (skb->mark) {
case RXRPC_OOB_CHALLENGE:
+ atomic_dec(&sp->chall.conn->n_oobq);
rxrpc_put_connection(sp->chall.conn, rxrpc_conn_put_oob);
break;
}
@@ -329,6 +330,7 @@ void rxrpc_kernel_free_oob(struct sk_buff *oob)
switch (oob->mark) {
case RXRPC_OOB_CHALLENGE:
+ atomic_dec(&sp->chall.conn->n_oobq);
rxrpc_put_connection(sp->chall.conn, rxrpc_conn_put_oob);
break;
}
Technical Details
Message-ID:
<20261123011320.4032340-1-linma@zju.edu.cn>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368933-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368933-linux-kernel-netdev=dewy.ru From: linma@zju.edu.cn (Lin Ma) Newsgroups: linux.kernel.netdev Subject: [PATCH net] rxrpc: Bound the OOB challenge queue per connection Date: Mon, 23 Nov 2026 09:13:20 +0800 Organization: Usenet Network Message-ID: <20261123011320.4032340-1-linma@zju.edu.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3761355"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:8AO4EulZVk2oH6DQrC5x9xFiRWk= sha256:Z28e8hhASXSMzj3vuPy+jbIRAZ6QalpeBRdRWn7Nbxk= sha1:Re+YCXxwH6BRZLpzMi+3nGoZ6fI= sha256:CFm/yv0P7HJ+kX+p523wYSplWgft3NrRrt6beoXEEZY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id D2AAC125D8B; Mon, 23 Nov 2026 04:14:40 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.951 X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7pKgSdUjqzQ3; Mon, 23 Nov 2026 04:14:37 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-368933-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=zju.edu.cn X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id BD157125D83; Mon, 23 Nov 2026 04:14:31 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 439DC2CF98; Mon, 23 Nov 2026 01:14:21 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795396459; b=iyQFmxlvsOarus8iKwvCG121vTMVZcwaDnkRK+c8tvyzl5KHs6Jhzcxl51HTckJZlAOA 59q5dTZ19lIPDPBAhyOt6ePNzygxWD9fX5vnLz/11Ts8T2Thhk3xtV71iSzCEdTX8g3oH mzA8mOb6Bx7GxqJ7GiynWG60HTW1ZIly0Enkoi/7C7c9SWQvN39gndtebPl4WNne4E8sB KLuCE2nv0NvFcj9ayvW4e77N18z6UIXzHekXHF3cDvgIL5/5DaQlhOvUOQpY3JAe2i9/+ 9JnLziOQLrmyNsmZgauStQVnSMTQnXxmCba+BEdV2LsgMj0HmZcM7UAZqKCXOCMru7Q== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795396459; h=X-Original-To:Received:DMARC-Filter:Received:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Transfer-Encoding:X-CM-TRANSID:X-CM-SenderInfo: X-CM-DELIVERINFO:X-Coremail-Antispam; bh=I6yOiTQDOMx7xgrbUTonjLgXgnPtkTY8xFHVLWTXSgY=; b=266IJF8By09FKy0D4cKYjvszgncKXU1XZ1/NbR7iuMGYmJxFKyoXNsZ9C82xxOlN5HvO zQgA0i6evnYA3GcbpIpTMyqp4t0wV1myPpbnFFBZ1Cq6yUIWvEAq9UfpKy9y8CmDDI0ss cTuukaPwVE7/c0cqEaFLjqMeqSC0MVe95tVBjmPtLmhW4drAkVi2PYUc/mem8QjSwwSdx Nx54I5Y8HwHStMUMD0cRDhFsPyeuiSHQLxmVTZ5W0yXqXKAbykGIEcxyNd88fpa6+zwqn p5XfUqLsTAhCBx64692g4vtVGeCuw5Z/ftYQVkDyfR+JTGS+yslqT6g9MLYzp4bl3ng== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=zju.edu.cn; spf=pass smtp.mailfrom=zju.edu.cn; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46796606A337; Mon, 23 Nov 2026 01:14:19 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=46.101.248.176 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795396453; b=p7hUrkCBJ24XKnL4Lov2r5JXCoyWoqqJcapYOUjFYS5jcbq3uvFZdDtIh7NGd4ug7Ez5 oPNafcJfyXxU2VAtaspA+FiOv7PrvGmj9P9xmpJabgfHNeGeWLBFZdfIZcSI1247exgPE PxgvVAqptfPvUDP7QozRyBDhZGb2mMGxCTOwXmaHdvcOlDx5MLkYnyMFeBzGsoRMSbyZx pnZ+rWI0iC1AEySSg0BfcPfQ00g/x3tGyrtdpKzTrpVISIOh2X+QkKyd/KUa0e0xq/kB7 TMsl5Tfi6Y2YUAqjKrAJIypOkAbfqH7iJd507kD2O3yVsPbEJpujUkio23r8fNfvDDg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795396453; h=DMARC-Filter:Received:Received:From:To:Cc:Subject:Date:Message-ID: X-Mailer:MIME-Version:Content-Transfer-Encoding:X-CM-TRANSID: X-CM-SenderInfo:X-CM-DELIVERINFO:X-Coremail-Antispam; bh=I6yOiTQDOMx7xgrbUTonjLgXgnPtkTY8xFHVLWTXSgY=; b=pqiO0V2b0dVRnk8n9W9fV9VnpxXUEi5XhtLjnC8G8Ato/UXfmyFh1tBe70mwucJy8/AC zXUi9raKqHOjluNUKCiUHRa6eTc5nV3rnbKTfHNfQcbrLPtoSnTFlCurpMymoox9BTUI8 qS0PRVwoZUEiNsl1cxCdIiep8VsRhZ3gtvB6y3Gjqm2qboa47a+gBg0kuTZdvonFwERTz aYRwlQOL16PXIIfskToFsgZyDQdz9EwEojM1y/oHtvg97Gv/P8mRaevubpGtz2OV9BYqQ MlZsBuObyf0WU+HSGMzOp919Dept1geNLKSPk4ojwk8ykXk7thP+bZ8B2t3LqdFXiOQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=zju.edu.cn; spf=pass smtp.mailfrom=zju.edu.cn; arc=none smtp.remote-ip=46.101.248.176 X-Received: from zg8tndyumtaxlji0oc4xnzya.icoremail.net (zg8tndyumtaxlji0oc4xnzya.icoremail.net [46.101.248.176]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78291606A32D; Mon, 23 Nov 2026 01:14:12 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 78291606A32D X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zju.edu.cn X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zju.edu.cn X-Received: from zju.edu.cn (unknown [123.60.231.41]) by mtasvr (Coremail) with SMTP id _____wDX7jRhkwNroc4sAg--.11219S3; Mon, 23 Nov 2026 09:14:09 +0800 (CST) X-Received: from ubuntu2404-234226.. (unknown [123.60.231.41]) by mail-app3 (Coremail) with UTF8SMTPSA id zS_KCgC3CqdgkwNr+K+BAQ--.37450S4; Mon, 23 Nov 2026 09:14:09 +0800 (CST) X-Cc: netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, Lin Ma <linma@zju.edu.cn> X-Mailer: git-send-email 2.43.0 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-CM-TRANSID: zS_KCgC3CqdgkwNr+K+BAQ--.37450S4 X-CM-SenderInfo: qtrwiiyqvtljo62m3hxhgxhubq/1tbiAwAMEmryeh4flAAqsA X-CM-DELIVERINFO: =?B?4xjnygXKKxbFmtjJiESix3B1w3tPqcowV1L23Bze5QtIr9Db75bEBiiEybVhThS0pI APHnkvfpsecr7gZmVpD/pedGcBqcyijhDw7SXfVbmqB2A4q20OOH9vDaY9MFicGtae2BFE fmb2ItgbSrUzSP2K/xkdSR+W6OnPV0BSgrrXxlRutGbGYt9J3uwFfeL9uPxtcQ== X-Coremail-Antispam: 1Uk129KBj93XoWxury8Jr17ur47Gr4kJF48Xwc_yoWrCF43pa 90kr93Kr4kXr1fCrZ3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