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 C5DA0213E6F; Thu, 12 Dec 2024 17:32:09 +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=1734024729; cv=none; b=narsxCWdnDuGdPNcfu1P18bOGH2R+fzTSVJ+PRxMvL5Nck42gVTzfc7exURqdi459Jl+vjy4FHDzhZKk3R0EMLTB9YPhV0aA7++SU1CH9pwvRK2JD3cPhB/1ezk4NwD21DiGGwRapyhnqu5UxoFXLNvTehaOfSixseV9aG8Yu1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734024729; c=relaxed/simple; bh=6HzHDSZVByceSj6cl2WDjJK5ZEENza3EU+n0VDfMwxE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fzKlFWUrqg/NFseFa87uhFM+EcGFvIGaqI9iv2aqXJwBkGiIKV3YUtwlSh49ZzRr4ALznqBEp1p7BKMCnBqHQDP2gGqPgfDiYW0q3a32VZDJimxx+Y+p+7busZ5X0g7LEzi5YHqUFHQU4KOBqQIArFjfWRGVOiNHl2PKVQDCNh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=T0O023Qb; 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="T0O023Qb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44ECEC4CECE; Thu, 12 Dec 2024 17:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734024729; bh=6HzHDSZVByceSj6cl2WDjJK5ZEENza3EU+n0VDfMwxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T0O023Qbcdqa7zmR03GFcNs6rDnUa+wzJUS4xFnxn5M0PvOLLuL7jPkdFJ0BUw350 1eeDmaSnDGvJ4QBOpUWPA/2cBkWYmFI6M6qR5YjgHvUax1mB1YxNisOw1X1wEcerrS y3votES8yuZ/kNU7Eyci4pzZkT8qiSgJC5cxPBnw= 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 5.10 393/459] net/sched: cbs: Fix integer overflow in cbs_set_port_rate() Date: Thu, 12 Dec 2024 16:02:11 +0100 Message-ID: <20241212144309.289424838@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144253.511169641@linuxfoundation.org> References: <20241212144253.511169641@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 5.10-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 2eaac2ff380fa..db92ae819fd28 100644 --- a/net/sched/sch_cbs.c +++ b/net/sched/sch_cbs.c @@ -309,7 +309,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