From: Ruben Wisniewski <ruben@freifunk-nrw.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH] gw-bandwidth: fix potential overflow on very large input values, limit them to 100 GBit/s
Date: Sat, 16 May 2015 22:26:43 +0200 [thread overview]
Message-ID: <20150516222643.1c390606@i3.local> (raw)
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
Signed-off-by: Ruben Wisniewsi <ruben@vfn-nrw.de>
---
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;
}
--
2.4.0
[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 303 bytes --]
next reply other threads:[~2015-05-16 20:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-16 20:26 Ruben Wisniewski [this message]
2015-05-16 22:50 ` [B.A.T.M.A.N.] [PATCH] gw-bandwidth: fix potential overflow on very large input values, limit them to 100 GBit/s Sven Eckelmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150516222643.1c390606@i3.local \
--to=ruben@freifunk-nrw.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox