From nobody Mon Sep 28 10:43:33 2026 Received: from mail-oa2-f11.google.com (mail-oa2-f11.google.com [74.125.231.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F088737F339 for ; Sun, 23 Aug 2026 05:53:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.75 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787464428; cv=none; b=Z3YaXbrp/w93nr7faFA53+l2342GTJjxDr6RdbEszTO+tuCKoRidfjHIwtBO8hRpyXlCc7WEo+hBh0AvkKaWOqSEP+BGKhZoTg11Vf1uGO6DdXZfmP6Qyks4iO0Atj/h+28NkyhyJrovUNhwWqaZm7cQ6cAH3kcKpsPpQQJGywQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787464428; c=relaxed/simple; bh=OYpKDRPJ5QqkKzY5a0l3W1nbybixDlewt8wC1thOTG4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tA+AryCBcZMBXFhsCwaRveT10Fi8HMwX+1tY+4ZTruXjpQkXZx9uZvRVwbaL6HDfk+E/RFBnMOoyCTkT7fKhapBBFWOXnx3uQGXuNyqU/0zWwGVZALWH9+AebmFk4vvCaEYSGvLzeEaN+55Jnc8Q691zmrQQNQ4c3tyOYtY3fUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D3HpT4vF; arc=none smtp.client-ip=74.125.231.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D3HpT4vF" Received: by mail-oa2-f11.google.com with SMTP id 586e51a60fabf-45e2c1e33e1so1762513fac.1 for ; Sat, 22 Aug 2026 22:53:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787464426; x=1788069226; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=q5ykELDhJxT1ChCufXvrVdtewa2pltNuabVAzU3EqHM=; b=D3HpT4vFCYaeWHezvW5SX+ghaGjDGjGXDMGDBHf2NsaKD32DV9cL2cVp5ZedPmWrQb hFoaRxvt9J+rtEZcPhAJ7rioencWr9Twa0gs4WMWQ002cAPxPWMWu2g9WQWbwc7//jb7 /RZtjD9Ay0BSVQRBMptYyxC+SiYIEpxNkScYW0plpm7A3+HiudOKBk+4YWMibJky9ZXV zzboJdvzRRODTBNV4tM1iYtnb52Q1s+GYOlU5P97Z0Ne+5oF7WZIuEghivz3wsk6lXXa t90NyhJSctg9nzjK/iI3WLlefUuoIpTdh42/LTxmHnc0eevWi5qO/BtSFKmFBW5CE2jf XYfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787464426; x=1788069226; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=q5ykELDhJxT1ChCufXvrVdtewa2pltNuabVAzU3EqHM=; b=dVY+cSX2VVl458EpLtXNEjKlEc5M0Be8O7c15hax4bLnBO13ZrSd9NwOAr1a4dt7dv MXED5m6QxuuWD/7ExrlLc6BBqc2OVKqm3glLk4drvFc/VsZiJrJfY7R9KxvX+cHdiGzP NAw9uLH1Vh6gaX0qcGdRiN/BsnTCO4eLTDCF6Jxp8QE8Eomd2L5RnfSenFcpkGTgmGJl B4bawGuHMi1jP5TJ1bl0jeVPSTkR0jDjnstBTKOvcYVrsp/KrMHlhmw6fR6IIBJb4r4O pfEOgNWr4j9xYGqGeqdwyCZm3V0T/fCSc5OPTA9ZE1qwAw8cBJohpWZX24pIPque0HX5 3dYg== X-Forwarded-Encrypted: i=1; AHgh+Rqo+RHrQaqqvz+b31hMy2zHLd/pSQCa2qivXjRoj9YABzuIDo9XbAlOlwJmRf0sAH+0cZUPOrHK8VJtj4I=@vger.kernel.org X-Gm-Message-State: AFuF++n2Z9hYy5lIGp0mVcgj68w8djAb166kYpcnk/nfEln+6p7egZEo kPSWr27G5SX6IEo+GfNbpkN8j1vaUFKFZGVh8qP2DaofyyO/zJ0dM7QhkdHaYMGpUPc= X-Gm-Gg: AR+sD12JiXcEvP2koSJ41I1VX0IrQF7VqZKBGdLXmJ7hhHTW4CjyRHtyocZtmPlSAFv CXIYvDk6HkTmPlRu9to2fNdeOwwgPeSm2fEEFnNOYfLqfwhvDxZTf/VFweSywBhbm5ZzXsJ8Jg8 t4HKomAdopI3V+7Om+Hum05WpIym417qejB+LvfnyDHU6YUTRSSSZRh1PbDjJAuBcJMq7dAZoU2 1nMDe+leSedGkAIPjWsqRKzMYhkg5RNrJvgFJtU2230cQiQz0N/IXXmUYRFJzKFm99m1p+hb/cb q6frWCZJnWAf8Alejle6D5i3s33mcnC5dEUnIhrdx/uY9/n6tHLO9pVvNjCXyoNLUx9GFXnry4I oUr+779cRVxGxQVFY0FsfqCUzxtWhz5Rlk94d5NWCG4JzDXj4QhUGw5wvPJmIZcGYCMCtokM9HC 4u4nIGuUJd2Nrf37Usg2D/jigc6Q4icm3VJ/vB151J9pFWQASbRbdhS8a1IKOSOENefjhtGyh4D zKtt70f7I2uIqIVtDSS1Jnp7JS+SdAEjhgU X-Received: by 2002:a05:6871:14e:b0:459:8f4e:94f2 with SMTP id 586e51a60fabf-46351380696mr16991206fac.10.1787464425834; Sat, 22 Aug 2026 22:53:45 -0700 (PDT) Received: from localhost.localdomain ([14.22.11.161]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4638313340dsm2791832fac.2.2026.08.22.22.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Aug 2026 22:53:44 -0700 (PDT) From: Henry Martin To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , linux-afs@lists.infradead.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org, Henry Martin Subject: [PATCH 1/3] rxrpc: fix stack OOB read in TLP soft-ACK processing Date: Sun, 23 Aug 2026 13:53:16 +0800 Message-ID: <20260823055318.371374-2-bsdhenrymartin@gmail.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260823055318.371374-1-bsdhenrymartin@gmail.com> References: <20260823055318.371374-1-bsdhenrymartin@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" rxrpc_seq_in_txq() is meant to test whether a sequence number belongs to a given txqueue segment, but it compares the in-segment slot number (seq & 63, range 0..63) against the segment's absolute base sequence (tq->qbase, 0/64/128/...). Two consequences: - For the first segment (qbase =3D=3D 0), any seq that is a multiple of 64 is wrongly judged to belong to it; - For any later segment (qbase >=3D 64), the test is always false, so TLP probe handling is silently skipped for them. In rxrpc_input_soft_ack_tq() the first case leads to test_bit(call->tlp_seq - tq->qbase, &new_acks) being evaluated with tlp_seq - qbase =3D=3D 64*N while new_acks is a single unsigned long on the stack, i.e. a stack out-of-bounds read 8*N bytes above new_acks (KASAN reports stack-out-of-bounds at offset 40 for tlp_seq =3D=3D 64). With a large enough tlp_seq the read walks off the vmalloc'd kthread stack into the guard page and panics. Turn the broken slot comparison into a real range check. This bounds tlp_seq - tq->qbase to [0, RXRPC_NR_TXQUEUE), keeping the test_bit() inside new_acks, and also fixes TLP probe handling for non-first segments. Found by the autokbug dynamic kernel fuzzer at Tencent Yunding Lab. Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission s= talls [RFC8985]") Signed-off-by: Henry Martin --- net/rxrpc/ar-internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h index 865f05fe37ab9..27992e10d82ad 100644 --- a/net/rxrpc/ar-internal.h +++ b/net/rxrpc/ar-internal.h @@ -1580,7 +1580,8 @@ static inline u32 latest(u32 seq1, u32 seq2) =20 static inline bool rxrpc_seq_in_txq(const struct rxrpc_txqueue *tq, rxrpc_= seq_t seq) { - return (seq & (RXRPC_NR_TXQUEUE - 1)) =3D=3D tq->qbase; + return after_eq(seq, tq->qbase) && + before(seq, tq->qbase + RXRPC_NR_TXQUEUE); } =20 static inline void rxrpc_queue_rx_call_packet(struct rxrpc_call *call, str= uct sk_buff *skb) --=20 2.43.0 From nobody Mon Sep 28 10:43:33 2026 Received: from mail-oa2-f0.google.com (mail-oa2-f0.google.com [74.125.231.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B62A37F339 for ; Sun, 23 Aug 2026 05:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787464435; cv=none; b=dQB83XUmsWQIqxtIQ8u13KhpVy0kiOtR8W7V4Z6qflaHqpYxjZincqgTT4Cytd7bOKD88DpoQLOaZhiamFeuwMNas9AJFJ6LBDEQvN9SgThEm63eBlRsmTMuBp1WQwpf0PPJdN0PEP9+EbRqgUPgSLbBDF9GIyGJ72mzxQf1OAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787464435; c=relaxed/simple; bh=SlD5lR1aIvJRJc4FywWIzTLHOW2kSU8TeeUrEUHNB5A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Or931jW/G2IO3AJdxPrrAqKFtuhG7tlYG88XS0gylTEemRPu9QIn/0K61e3JItGSFIoiyecvbZFPykTRd+uKEK+5oIWLdjlScpdtI9GSg4+a0XXl0e5v/gcVegtY+nDsu+uu+Zxs1DA0vUkk2tqEOZg+hWiCJF9r6tdwCI8anbM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Jwzv8lvY; arc=none smtp.client-ip=74.125.231.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Jwzv8lvY" Received: by mail-oa2-f0.google.com with SMTP id 586e51a60fabf-4569f25c19dso861223fac.0 for ; Sat, 22 Aug 2026 22:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787464433; x=1788069233; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=cfeuwGJyq2Vxzfo2kOM1yuG2Ob6x8BTRxw3KWGoeGBQ=; b=Jwzv8lvYOMyOw4XHSl6WGHODSjHZfBVbizNwqnfXeQSmqc0etfG09JEAbZV/Uys801 XqM90y9+gc6C5TMp70L4OiTIlfwEhr6OXb2a7tPch6GynNct8gE3uHlIvj5hpFl90kCJ 3EmFIz+wZb6m4UvblVVcVHd6j+mSs3M5WOlb5HdDX4pwkSH5+eP5gfApv7uBooD+40nh mGNaBd+VBo4fkLnfB7BAD7e7ke1+2Io97hj0uRBFXxniKzyu/tu8nQHt2Ig29Z05XnMt CtHN0ZEiB2crQIpqalspxytH28P3xjTwTgspdhjLYo3ZQWI4BWfWuVgznsIntducxb0G k9Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787464433; x=1788069233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=cfeuwGJyq2Vxzfo2kOM1yuG2Ob6x8BTRxw3KWGoeGBQ=; b=h18Uo7eFzfvmBiNftaCJ4wFdqcu8tNIca4ODsGHqcsU0jj42cfCajj/cOtPNVXE40i UxU+PYC2YcVqJf2Dk+7scy2c/wJj6mngFM9lVNpX6hkMeJwtNI05M7bqey7STjRQtYVs a4jIW6auNqxiQLPp0IkoFvD7nV/HG1mAhLxkGvCbK8PeLoB8XlViKdgLD19NsFdVnBmY /PqMnBpRA10cJpFRAFqdXnvZx0CQhHDy1cB8D7pEea2b4ODFJJYdpt++5xGwd5wY+rlx u1ctRzDi/FVEBbpx/4PuE4HLVJTsFmkwC9mp9O8kOAEfqy74OifHrrp4zbdXSFS5FKPx oP9w== X-Forwarded-Encrypted: i=1; AHgh+Rqyy/IKxMUhqNP4gNBM5G8tYl/CkdQohqqcouKfV3oALQ10z/V5e8T6dBXjfQy8BaEznGoG5umRidJ6m8U=@vger.kernel.org X-Gm-Message-State: AFuF++kQatmUvDm6/FtFcu1Xp92gJSK3Y8uxxEW451Zl53KzncxplMW6 AU60OOGTWnSJJS8aC898f8ffn9MJ/ugFfS5vKZ2HRLmlmvsO1jT7f0V2 X-Gm-Gg: AR+sD11ujdbse/7xQSIvgm91/TbJqLvCFig/GeFt0ZbchM5kNmaK804/W/Ru18d1N6u 0CDdYqDvJZK9yjwEgjKGjUzoPCrAJ7N8/+t/HVSHDiKaiS9tUl0UTvdxWGhrjxqwr9FWD1kEULz 0CbD9sS/kkMh3G9sHYQW4FMkqUIC8kscortyPIvxGUvqpH89M5C7J/it/UqJyjyG5v/roGj2QJ1 v3ezQzb2fiGCuAgbuLk7C8/CxvpsgfHgilifPLGiJ2JAWNMi5YgeF+Sp+He7WXqptvglkANjf6w M+Lzs1wwHne9eJliBSk5qNQ3sxEkmTijWQBDIj6R6xVTUw/CWasGuZOAxBSdk6p59v7r+6YbOP9 a2kyFD5CHxdKxELffS61HQ+PhWKe3fJEQOJ+YcHIpPqYIIMT7WOPNB+8v92qG3lBLZI7ZBl24tj FZmBJ6aBnSzcBPD7qao63KTmxlmaJNi43L3fkh/zzZ8mHwjVG/A3Hu0rdaYjrKsY4+XOXIIgtmg q5cNa+PHHJrZZKIZ3w1TIb0cQ== X-Received: by 2002:a4a:ec4b:0:b0:6b1:3cb7:f535 with SMTP id 006d021491bc7-6b158fcbe26mr18729841eaf.0.1787464432934; Sat, 22 Aug 2026 22:53:52 -0700 (PDT) Received: from localhost.localdomain ([14.22.11.161]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4638313340dsm2791832fac.2.2026.08.22.22.53.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Aug 2026 22:53:51 -0700 (PDT) From: Henry Martin To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , linux-afs@lists.infradead.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org, Henry Martin Subject: [PATCH 2/3] rxrpc: wait for deferred conn destruction before conn_proc_list check Date: Sun, 23 Aug 2026 13:53:17 +0800 Message-ID: <20260823055318.371374-3-bsdhenrymartin@gmail.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260823055318.371374-1-bsdhenrymartin@gmail.com> References: <20260823055318.371374-1-bsdhenrymartin@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" rxrpc_destroy_all_connections() flushes rxrpc_workqueue and then immediately asserts that rxnet->conn_proc_list is empty. However, connection destruction is normally deferred to system_wq: the final-ACK timer is still pending when the last ref is dropped, so rxrpc_put_connection() schedules conn->destructor instead of running it inline. conn->proc_link is only removed by the deferred destructor (rxrpc_clean_up_connection()), which the flush_workqueue(rxrpc_workqueue) call does not cover - so the assertion can fire on a perfectly healthy intermediate state: rxrpc: Assertion failed kernel BUG at net/rxrpc/conn_object.c:488! Workqueue: netns cleanup_net The BUG kills the cleanup_net kworker mid-teardown, leaving the netns half-destroyed and potentially wedging later netns operations. This is easily reachable from an unprivileged userns+netns running loopback AF_RXRPC traffic. The existing wait_var_event() on nr_conns is exactly the right synchronization: nr_conns only reaches zero after every destructor and RCU free has completed, which implies proc_link has been removed from every connection. It is, however, placed *after* the assertion it is meant to make reliable. Move it between the service_conns leak check (whose outcome is already final once the reaper has been flushed) and the conn_proc_list assertion. This also silences the spurious "AF_RXRPC: Leaked peer" messages seen during netns teardown, which share the same root cause: peer references are dropped by the same deferred destructors. Found by the autokbug dynamic kernel fuzzer at Tencent Yunding Lab. Signed-off-by: Henry Martin --- net/rxrpc/conn_object.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c index 0ece717db0f85..df3f92b1a42e9 100644 --- a/net/rxrpc/conn_object.c +++ b/net/rxrpc/conn_object.c @@ -485,11 +485,13 @@ void rxrpc_destroy_all_connections(struct rxrpc_net *= rxnet) write_unlock(&rxnet->conn_lock); BUG_ON(leak); =20 - ASSERT(list_empty(&rxnet->conn_proc_list)); - - /* We need to wait for the connections to be destroyed by RCU as they - * pin things that we still need to get rid of. + /* Connection destruction is normally deferred to system_wq because + * the final-ACK timer is still pending when the last ref is dropped. + * Wait for the deferred destructors (and the RCU frees) to complete + * before checking conn_proc_list; they remove conns from it. */ wait_var_event(&rxnet->nr_conns, !atomic_read(&rxnet->nr_conns)); + + ASSERT(list_empty(&rxnet->conn_proc_list)); _leave(""); } --=20 2.43.0 From nobody Mon Sep 28 10:43:33 2026 Received: from mail-oa2-f11.google.com (mail-oa2-f11.google.com [74.125.231.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90E26331EA4 for ; Sun, 23 Aug 2026 05:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.231.75 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787464443; cv=none; b=OUD/pYpj5q8r1bnbfB289BS5FspyRG5pLo8C66MmQag68uT7o4dYSdFevdM27OpHX8kOPuZW0WxHYBPw0DQ4f2ZcZ7LWuhk3t7/qKhbND5+J2U9ZRNHyW5+RF9bIatfhGczej8qm/+wk7kyoxE1oQT9x+ksUyGKavT5Gk/Vf+iA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787464443; c=relaxed/simple; bh=tpjh1uatBlhYLlD5vAk+xB/DquSmvzWDtmA63zML9yw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c1+K6NGqrrpPhf2D16ONrsA2Dxu4IYUz/mI0MOVvD5g9KAs7+Jc6BoS748TUG1CwE/gRMHfP76wMAwCWzD+4gVbQkHYMd0pzgqcqt3kVdEXYDmMyaZJ2n8zfoITlGthbY/lydTjMyYMMrNI410o7qxaQQnBZ5U6Sf79z0SYuFNU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FGHx/5EM; arc=none smtp.client-ip=74.125.231.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FGHx/5EM" Received: by mail-oa2-f11.google.com with SMTP id 586e51a60fabf-462dec1c4c5so1083274fac.0 for ; Sat, 22 Aug 2026 22:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787464440; x=1788069240; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rsONA6Rm8WFDnPmCZS0NGqffUBQ3s2z+UFLSP3FHVZc=; b=FGHx/5EMVRqr4KbrmtOJn9a3Tax/TJWfkhT9KSdpP59KuAmZ1rcloM6h5q1PU/cdam hfX2MBNPyKwRN0DRIfaL0RA5QhQk3twceha+bZgYrFWE+a+FqMMQpVfokmjmRPhAbUf8 Bxh8YsRC5MWPbLDHbpFAxB+1sKbVy9v0cYOs5D7VZn03/TPQ6l27lc7Nn/8qUkVHxTR0 ClQ869WwWzTfo6Cs4mEjsb4XDxg56CwHgfRP/5Wy8gPC+adOaaYWqpLuC+hIq22ZB7Jf bM+EOM2LUgkscKTl/QwGqh3dy//+O2oEL8h4WoD2ShPbEGI9WXxJdW3q3WNtjrBihorj +Srg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787464440; x=1788069240; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=rsONA6Rm8WFDnPmCZS0NGqffUBQ3s2z+UFLSP3FHVZc=; b=NP/YaItUM58hvNjAFtRsl/bSWdLbpO3MrEgbA+MGfb3sklYx6SEg0I8AS7uY7CBBuF cYUhb9GTxcNiAD5Gpklc7m/PyZ3IneYPy59G1RZ/80yHImmBKYqXRX8IXiRgYLYKqGbc HnN8LXt6CN2oPb3BcXK+8HA0XDoQaROQXg7XlLlKNjwy12ELR3mmLBdPc/IkPwlpufAp oaXEOxvWfmw5pyTNh4aHwYmpg5OrS8d43V9gQZO3QvYX37L7Je2biSSzwdfVDf4/dYOY 9pR3phbu1pymH+kSNuAKWf3tGHmPN5N0daf5wcKGliv8hda3ZMHsKkHDU9G4QF8oX32i vnGA== X-Forwarded-Encrypted: i=1; AHgh+Rpe7u1Hf68HwDchcVIn4mQRokenQhxNTTQNzngegoBZEJ7cagX3Ss06dS/QwOPe34iEIIMCVaijnY4osFo=@vger.kernel.org X-Gm-Message-State: AFuF++kv5lzlF0F5zJxokbtAhFxYmo0/HpKDNlueBVcpGDLd/T8AON3b AtK3T/S7eoGlfbTm/jyfFaZmIyg9CgUpcqmS74KeEb0Fzbn4Xpl/jd31 X-Gm-Gg: AR+sD11+9l96w+jw3nMzOkplKntvNQKFsFdqRXB69VSqSESdMCm+khZOrWbeU43ps4a NE7oEWZYnTRvVe+6ZMUUPkuFZgQaw08VahR8IZzebjNb8Prj2o0YfpZL1gMJ4mvwrHx9axjG0hM grmxoyS7o5ZAw/Mk1a30NhLCczZc1EHmBjcdW+HcJv0583gDyw1ux/EFgobkhkyBk0NTQMCiNuY flJenTYqlpnwApgroWP8JVdKw7ozBMqeb5nEjC0CNCxUpnnD2JUceb8WjVY6HjAWhJgs4j7Mx+y P8FKw/LPCrcUhC7PVOvHy/9LdNg1jef9BmqDVizjPDzBFifQylvg3k0X/gm83nENZreHZEHXIMd WV6YbcR5SfFlO+SzTv7pdHL27ffAxGuYNtSTSM0TEtapvyKQHHso7QOevTGjEoK2hnNLFcK7B4Y G3nELNEjLc3gT415lCFRfwd8x4aiZhnxfYFI0ijbQrLxn7TPyYJJluZMAxOB5WyELEGEn0UnP38 EqWaeg9WqcewWv8NbPGJQbD3cADmfYM19tz X-Received: by 2002:a05:6870:80d3:b0:44c:5514:4e7b with SMTP id 586e51a60fabf-46350f9e304mr18570451fac.2.1787464440308; Sat, 22 Aug 2026 22:54:00 -0700 (PDT) Received: from localhost.localdomain ([14.22.11.161]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4638313340dsm2791832fac.2.2026.08.22.22.53.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Aug 2026 22:53:58 -0700 (PDT) From: Henry Martin To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , linux-afs@lists.infradead.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org, Henry Martin Subject: [PATCH 3/3] rxrpc: recheck RXRPC_CALL_TX_NO_MORE after sleeping in rxrpc_send_data() Date: Sun, 23 Aug 2026 13:53:18 +0800 Message-ID: <20260823055318.371374-4-bsdhenrymartin@gmail.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260823055318.371374-1-bsdhenrymartin@gmail.com> References: <20260823055318.371374-1-bsdhenrymartin@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit ae4f89989479 ("rxrpc: Fix ability to add more data to a call once MSG_MORE deasserted") added the RXRPC_CALL_TX_NO_MORE flag and an entry check in rxrpc_send_data() to stop late sends on a finalized call. However, the check runs only once at function entry: when the transmit window is full, wait_for_space drops call->user_mutex and sleeps, during which another thread sharing the same user_call_ID can finalize the call (queue the LAST packet, setting TX_NO_MORE and clearing send_queue). Upon waking, the reload path only re-verifies the shutdown flag and call state - and a just-finalized call is still in RXRPC_CALL_CLIENT_SEND_REQUEST until its data is hard-acked - so the thread proceeds to rxrpc_alloc_txqueue() with send_queue =3D=3D NULL but tx_queue !=3D NULL, triggering: WARNING: net/rxrpc/sendmsg.c:297 at rxrpc_alloc_txqueue and returning a spurious -ENOMEM. The call state itself is entirely legal at that point; the WARN_ON's implied assumption that send_queue =3D=3D NULL implies tx_queue =3D=3D NULL simply does not hold af= ter finalization. Re-check RXRPC_CALL_TX_NO_MORE in the reload path after reacquiring user_mutex, mirroring the entry check, and bail out with -EPROTO. Found by the autokbug dynamic kernel fuzzer at Tencent Yunding Lab. Fixes: ae4f89989479 ("rxrpc: Fix ability to add more data to a call once MS= G_MORE deasserted") Signed-off-by: Henry Martin --- net/rxrpc/sendmsg.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c index ed2c9a51005ad..b39af552c6b46 100644 --- a/net/rxrpc/sendmsg.c +++ b/net/rxrpc/sendmsg.c @@ -358,6 +358,14 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, if (txb) rxrpc_see_txbuf(txb, rxrpc_txbuf_see_send_more); =20 + ret =3D -EPROTO; + if (test_bit(RXRPC_CALL_TX_NO_MORE, &call->flags)) { + trace_rxrpc_abort(call->debug_id, rxrpc_sendmsg_late_send, + call->cid, call->call_id, call->rx_consumed, + 0, -EPROTO); + goto maybe_error; + } + ret =3D -EPIPE; if (sk->sk_shutdown & SEND_SHUTDOWN) goto maybe_error; --=20 2.43.0