From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EEE5223C49; Thu, 12 Dec 2024 16:32:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734021173; cv=none; b=f5T/wRjKxIsF/T1m1J/K12ZV2qcrF/E7z1X07+1Tn6nktHfHBAA3eaQt19leTOVVGXqWLYBCWpI9QDnrxR3QrZgtlzgvFwXRdvMGbXl+BB+GEijaJsmcOcR56pwmOGJaZ/2+joQBMQ9c/At5fZ9ZCAz+dEVaYUfOpWbjNqyYYBQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734021173; c=relaxed/simple; bh=oj99FP9OQQArVuJkrydngOkYAU79tjsAwLfaa9KT/SI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WhfuUlU9730VRxUjY7NGJI6FWplEi1w2yRhpQ+O06cHvAcz3UkDUWgw6IuV6ZinwDJXitNT7J0BZFP1OYOpAb++OeYjabvGrvKEk3wRGUc4vqxJaywb2N0HiN1H2cmnInSnMtixvZdWabR/B5I9KdwSkUL44kNjd38FgmiV9h7Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EUUkOW5e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="EUUkOW5e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B086C4CECE; Thu, 12 Dec 2024 16:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734021173; bh=oj99FP9OQQArVuJkrydngOkYAU79tjsAwLfaa9KT/SI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EUUkOW5exdQH9wclYmTL41urnzyu/619pX6zZ50c652qyMGjKxP057FT/aFdU6wCj +qgPZ5z/Hh3EWhtok1CZfNdgOv5EZ2nDI9U9T5OYJBLqnLVcyt/ve3bxIprRTHfK3f Ii6o86L0F09N1I6B7M8oH4zngsY8kow5lhKTTQIo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Elena Salomatkina , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 666/772] net/sched: cbs: Fix integer overflow in cbs_set_port_rate() Date: Thu, 12 Dec 2024 16:00:11 +0100 Message-ID: <20241212144417.437601388@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144349.797589255@linuxfoundation.org> References: <20241212144349.797589255@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Elena Salomatkina [ Upstream commit 397006ba5d918f9b74e734867e8fddbc36dc2282 ] The subsequent calculation of port_rate = speed * 1000 * BYTES_PER_KBIT, where the BYTES_PER_KBIT is of type LL, may cause an overflow. At least when speed = SPEED_20000, the expression to the left of port_rate will be greater than INT_MAX. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Elena Salomatkina Link: https://patch.msgid.link/20241013124529.1043-1-esalomatkina@ispras.ru Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_cbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c index cac870eb78973..0567a15d0f850 100644 --- a/net/sched/sch_cbs.c +++ b/net/sched/sch_cbs.c @@ -310,7 +310,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q) { struct ethtool_link_ksettings ecmd; int speed = SPEED_10; - int port_rate; + s64 port_rate; int err; err = __ethtool_get_link_ksettings(dev, &ecmd); -- 2.43.0