From nobody Fri Sep 25 13:18:48 2026 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (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 4CFC6378D94 for ; Sat, 12 Sep 2026 03:57:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789185433; cv=none; b=JBomAKawSl4e0g9N4II5q9UP5U819RNFNZk4HxEJSdGx5CC3MzKX5qPsCxgLJk0FT7qSQhs+I8gqjmtLvlhl4CUhB89V4rQ69omzod5Qg+M1Z6kKrBVau4RuVXcxX9nXvKEwGjxHUsk+7iva/ZKiZUU8kNg6Kmu3PtD8/7LnPhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789185433; c=relaxed/simple; bh=nEYVPwCFDnBCF24sANEBFZ55tkqiF4LKtVf0rB2hQ2E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aTkt7Jmj/g6YYNeXCtz9zGzI+XpEvr+b4K2eipO2keZyQuO8s4GINiQSwz+6Zte3k0Z/umKKVRU5fxP4NChUDHBDBZh+nVbLsfKUdyOt5XprGqX/caHEuUoZcfCbyxhpunO84QsyAZeq7exh1jOHebtpHDcWs+HJCm+xAIq3JxA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=nebusec.ai; spf=pass smtp.mailfrom=nebusec.ai; dkim=pass (2048-bit key) header.d=nebusec.ai header.i=@nebusec.ai header.b=fJz+kNp+; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=nebusec.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nebusec.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nebusec.ai header.i=@nebusec.ai header.b="fJz+kNp+" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-cc4d03f95dfso828637a12.2 for ; Fri, 11 Sep 2026 20:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nebusec.ai; s=google; t=1789185430; x=1789790230; 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=gFsPOOs+5rcBWfV3FhiHZ78dDluV27U/FXNygCAg6wI=; b=fJz+kNp+PQHDjlOwmmBpg5hdejlfojifH1hARbglIneEihYwuIPaVaUtOj2uRd/U4/ mscD1dKSHaVZWCHHLeh8RBToTvbNo7qdvB1j9zZ+nGmmuyhy3xQuOk62F4c2SDJDVXRj fTxOdUlgap2qJAou2q1exUyb/0meghRURtYGyDr+zMAqo44cy7XuUPQCiaaKH3nXbYUP lQq/uSoE7iSrwpbx0cyOcq33CboIFqAVjsSPXTsGiAV0l0jZaGBqzXXXtYCYJ0tjkKsr CJMmQhvhYCUruOyfRTJPFV887LpPKsMYW2tC3Ic23M4E7n+xi5res8H+UbZLYHzULeCL DUSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789185430; x=1789790230; 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=gFsPOOs+5rcBWfV3FhiHZ78dDluV27U/FXNygCAg6wI=; b=hVHzE1LCYIyD/T5swgJB39YBNsXAJNnsHoZVDaOL3KdrXaPBwkfyj1rZdJ1jk1lhph 65m0V7EHsvYteYGBQbgJsJlJYsFZ3osyambt6g1pzXMKJOXBfS5bHbZlBdnGxzHHD2R9 t75ZsU5JJrYtiLF14nAch290HZFWWNaVQMaCoi8kHYcOcCcMDRxZBbohqyDBNCH4xs6C GTAMwSuLf+ZNxmcXEzZEa+YqQWhvAlYTtYOLhNADwrdBLc30QzbWEsHZZJguzuwzVylX +d+leJOebosilwXfOZZlqdhxmLx9/dOrjTZxAT4rOlt/5wcBermh+j0L2GP4Pi/zGz0f ZSXg== X-Forwarded-Encrypted: i=1; AKwUvBzOr52Cu/Ozj0U6riZMt3TBW4XDU5lBwnTXtTOuOlGF9hMwGgOL0uQ+Cn/VMdVt2PnVDn+6pamG/kA3bOA=@vger.kernel.org X-Gm-Message-State: AFuF++kKC1B+FZkMDPwfnRi7P+JWzPbdsZ6NG5GZpuutf5nzxyCNIttm tWry5dbhgqvExMBRTPrVgDqmspw5r1AM/N5IdkwjFRJph2D8xqzw9QVLt0yHbd8v9xRk X-Gm-Gg: AYBFou0lI+td2a9NF4AAu5prNo2nX2jUDKG+8OMJ3xaQq70LCHjBKyMQ3djj5WvEWX9 khdxYAwxh3sse+H/C8MMsPi2wq5p8z+Ekl3fr5Dtxq69nyZiaE+VF70PwXcXJo3Msw34cjpELo6 fVVn0W1aRZhX8q4kZEXOImYfV8dJU50NCZGWPrHaxzUIcPjlnGaaJpmUM4JMhYChd1CMyTRIdiR C7QIDy+rmbz9zD4mGSoHdXVPTSLt/LkWH/ClvTVeLNQiyn0AsOiZVQWb3l/3lMrUYwIh3mOSnNs Uo81xOU6d39EPPsayidWNcC2x9GvAW5vZJ/qmUt5QzF2tHgrktJskrOkjWF06kNE1tY0jV4xdtW +NdozZEVbMcAhO2W5mI6q48vIfPlKj/A7t5V/CjS7JRIDYnLejDiE0KkdndcwiuByvgwg0sSd8J 7+yyJ1OGUArvhKwdq9vtIWyr2DzbfC7XSEBosFaHdFGIXl8PqGkBw+bCEVbnLnXNalxS91LkVYZ sinnHwyaCYRZXrnKGDUJDIjHUj/kg== X-Received: by 2002:a17:90b:2b50:b0:380:21b7:e727 with SMTP id 98e67ed59e1d1-39d9c1c199dmr12405499a91.14.1789185430385; Fri, 11 Sep 2026 20:57:10 -0700 (PDT) Received: from b6ad5085b32f.. ([122.51.212.64]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39d95864b4fsm8454407a91.15.2026.09.11.20.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2026 20:57:09 -0700 (PDT) From: Zihan Xi To: horms@verge.net.au, ja@ssi.bg, pablo@netfilter.org, fw@strlen.de, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: zihanx@nebusec.ai, phil@nwl.cc, netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Vega , Luxing Yin Subject: [PATCH nf 1/1] ipvs: avoid stack overflow from recursive connection expiration Date: Sat, 12 Sep 2026 03:56:51 +0000 Message-ID: X-Mailer: git-send-email 2.47.3 In-Reply-To: References: 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" When a controlled IPVS connection expires, its controller may be expired synchronously if it has no remaining controlled connections. A chain of controlled connections can then cause recursive calls to ip_vs_conn_expire() and exhaust the kernel stack during namespace cleanup. Defer controller expiration to its timer instead of expiring it synchronously. Set its timeout to zero, expedite its pending timer with ip_vs_conn_expire_now(), and drop the temporary reference. This preserves the existing cleanup semantics while limiting cleanup to one controller per timer callback. Fixes: f9200a52eedf ("ipvs: avoid expiring many connections from timer") Cc: stable@vger.kernel.org Reported-by: Vega Assisted-by: LLM Co-developed-by: Luxing Yin Signed-off-by: Luxing Yin Signed-off-by: Zihan Xi --- net/netfilter/ipvs/ip_vs_conn.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_con= n.c index 6fa3e1dc534c3..023c01707d862 100644 --- a/net/netfilter/ipvs/ip_vs_conn.c +++ b/net/netfilter/ipvs/ip_vs_conn.c @@ -1330,20 +1330,6 @@ static void ip_vs_conn_del(struct ip_vs_conn *cp) } } =20 -/* Try to delete connection while holding reference */ -static void ip_vs_conn_del_put(struct ip_vs_conn *cp) -{ - if (timer_delete(&cp->timer)) { - /* Drop cp->control chain too */ - if (cp->control) - cp->timeout =3D 0; - __ip_vs_conn_put(cp); - ip_vs_conn_expire(&cp->timer); - } else { - __ip_vs_conn_put(cp); - } -} - static void ip_vs_conn_expire(struct timer_list *t) { struct ip_vs_conn *cp =3D timer_container_of(cp, t, timer); @@ -1372,7 +1358,9 @@ static void ip_vs_conn_expire(struct timer_list *t) (!(ct->flags & IP_VS_CONN_F_TEMPLATE) || !(ct->state & IP_VS_CTPL_S_ASSURED))) { IP_VS_DBG(4, "drop controlling connection\n"); - ip_vs_conn_del_put(ct); + ct->timeout =3D 0; + ip_vs_conn_expire_now(ct); + __ip_vs_conn_put(ct); } else if (has_ref) { __ip_vs_conn_put(ct); } --=20 2.43.0