From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.migadu.com (out-93.mta1.migadu.com [95.215.58.93]) (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 6FCCF3F329F for ; Thu, 1 Oct 2026 11:30:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.93 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790854222; cv=none; b=HuMZFzCp7bIfc9BtVcXEyWRQuWeHg0WGb8OG/zg865iMcaGci6OQrdNC2/uWIKQJur70tt2ibUMJopaMDx1vE+jHUy5NrNSGhM525Sfj/dKiEFMvjQMjpQNgsZ7LES8/Lnw+6KiiZrX3IMJ5D1mK+Q3zrxHvgpEPYpL8F3Iiq4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790854222; c=relaxed/simple; bh=SjbMw+wxVwqnc2+u/HZnWR9k+sH+pYYIMyAY1Z6Aovo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gr08+KhE/ETI1CpFrWcn3bbaVckk6++1+Zxu+1q4Q+nkltwUr6cDav4rjp/5ziqXfKMRAXraFgWQ3dxdN83AEC4vk93J71rRMdr0uPHoCb80fzkltO9eq6dm772rs9BI/8z3xh3cDor/mRzNKJv30K4VsewtsTfrPViOPx2KlV8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=tJTX2Eqy; arc=none smtp.client-ip=95.215.58.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="tJTX2Eqy" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=SjbMw+wxVwqnc2+u/HZnWR9k+sH+pYYIMyAY1Z6Aovo=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1790854212; v=1; x=1791459012; b=tJTX2EqyVmWJ7WF6L3F2BUg1Rh737/p7eXmehi56JLPxet5ZMwGGbFBckUZwcbf/XduGz8/7 SjkCQ9fQZvOhJxUHyPhfGWd/2DONt9fJJp7JsT14mWykvn3rxH7zmxDYEGA7IS9F11PcuyoYxdN 9SZl13GIxgIcwQh5xHRlDISM= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id d01d38ee60a240a4; Thu, 01 Oct 2026 11:30:09 +0000 X-Mizu-Trace-ID: d01d38ee60a240a4 X-Migadu-Flow: FLOW_OUT From: Jiayuan Chen To: netdev@vger.kernel.org Cc: Jiayuan Chen , VEGA , Eric Dumazet , Eric Dumazet , Neal Cardwell , Kuniyuki Iwashima , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Simon Horman , Stephen Hemminger , linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 1/3] tcp_bic: fix divide by zero on max_increment == 0 Date: Thu, 1 Oct 2026 19:29:41 +0800 Message-ID: <20261001112948.322463-2-jiayuan.chen@linux.dev> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261001112948.322463-1-jiayuan.chen@linux.dev> References: <20261001112948.322463-1-jiayuan.chen@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit max_increment is how many packets cwnd can grow per RTT, so 0 makes no sense, and bictcp_update() divides by it. Reject values below 1 when the parameter is written. Fixes: 83803034f423 ("[TCP]: Add TCP BIC congestion control module.") Reported-by: VEGA Signed-off-by: Jiayuan Chen Reviewed-by: Eric Dumazet --- Target net-next since it is not a big problem. --- net/ipv4/tcp_bic.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_bic.c b/net/ipv4/tcp_bic.c index 65444ff142413..27d2e38ff7932 100644 --- a/net/ipv4/tcp_bic.c +++ b/net/ipv4/tcp_bic.c @@ -27,15 +27,25 @@ */ static int fast_convergence = 1; -static int max_increment = 16; +static unsigned int max_increment = 16; static int low_window = 14; static int beta = 819; /* = 819/1024 (BICTCP_BETA_SCALE) */ static int initial_ssthresh; static int smooth_part = 20; +static int max_increment_set(const char *val, const struct kernel_param *kp) +{ + return param_set_uint_minmax(val, kp, 1, INT_MAX); +} + +static const struct kernel_param_ops max_increment_ops = { + .set = max_increment_set, + .get = param_get_uint, +}; + module_param(fast_convergence, int, 0644); MODULE_PARM_DESC(fast_convergence, "turn on/off fast convergence"); -module_param(max_increment, int, 0644); +module_param_cb(max_increment, &max_increment_ops, &max_increment, 0644); MODULE_PARM_DESC(max_increment, "Limit on increment allowed during binary search"); module_param(low_window, int, 0644); MODULE_PARM_DESC(low_window, "lower bound on congestion window (for TCP friendliness)"); -- 2.43.0