From patchwork Sat May 16 20:26:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruben Wisniewski X-Patchwork-Id: 4407 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=46.38.231.10; helo=we70a.netcup.net; envelope-from=ruben@freifunk-nrw.de; receiver=b.a.t.m.a.n@lists.open-mesh.org Received: from we70a.netcup.net (we70a.netcup.net [46.38.231.10]) by open-mesh.org (Postfix) with ESMTPS id C3E0D60155B for ; Sat, 16 May 2015 22:27:13 +0200 (CEST) Received: from i3.local (unknown [77.87.49.91]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by we70a.netcup.net (Postfix) with ESMTPSA id 4F1FC47468 for ; Sat, 16 May 2015 22:27:05 +0200 (CEST) Date: Sat, 16 May 2015 22:26:43 +0200 From: Ruben Wisniewski To: b.a.t.m.a.n@lists.open-mesh.org Message-ID: <20150516222643.1c390606@i3.local> Organization: Verbund freier Netzwerke NRW e.V. X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Subject: [B.A.T.M.A.N.] [PATCH] gw-bandwidth: fix potential overflow on very large input values, limit them to 100 GBit/s X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 May 2015 20:27:13 -0000 Signed-off-by: Ruben Wisniewsi --- net/batman-adv/gateway_common.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index 39cf44c..6b0f4d3 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c @@ -71,10 +71,16 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, switch (bw_unit_type) { case BATADV_BW_UNIT_MBIT: + /* limit input to 100 GBit/s */ + if (ldown > 100000) + ldown = 100000 *down = ldown * 10; break; case BATADV_BW_UNIT_KBIT: default: + /* limit input to 100 GBit/s */ + if (ldown > 100000000) + ldown = 100000000 *down = ldown / 100; break; }