diff options
author | Sven Eckelmann <sven@narfation.org> | 2017-12-26 15:14:01 +0100 |
---|---|---|
committer | Simon Wunderlich <sw@simonwunderlich.de> | 2018-02-25 20:19:34 +0100 |
commit | f22e08932c2960f29b5e828e745c9f3fb7c1bb86 (patch) | |
tree | d4c971d4feef6c4553cb659cada3cab0b159ed17 /mm/zswap.c | |
parent | fce672db548ff19e76a08a32a829544617229bc2 (diff) | |
download | linux-stable-f22e08932c2960f29b5e828e745c9f3fb7c1bb86.tar.gz linux-stable-f22e08932c2960f29b5e828e745c9f3fb7c1bb86.tar.bz2 linux-stable-f22e08932c2960f29b5e828e745c9f3fb7c1bb86.zip |
batman-adv: Fix internal interface indices types
batman-adv uses internal indices for each enabled and active interface.
It is currently used by the B.A.T.M.A.N. IV algorithm to identifify the
correct position in the ogm_cnt bitmaps.
The type for the number of enabled interfaces (which defines the next
interface index) was set to char. This type can be (depending on the
architecture) either signed (limiting batman-adv to 127 active slave
interfaces) or unsigned (limiting batman-adv to 255 active slave
interfaces).
This limit was not correctly checked when an interface was enabled and thus
an overflow happened. This was only catched on systems with the signed char
type when the B.A.T.M.A.N. IV code tried to resize its counter arrays with
a negative size.
The if_num interface index was only a s16 and therefore significantly
smaller than the ifindex (int) used by the code net code.
Both &batadv_hard_iface->if_num and &batadv_priv->num_ifaces must be
(unsigned) int to support the same number of slave interfaces as the net
core code. And the interface activation code must check the number of
active slave interfaces to avoid integer overflows.
Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Diffstat (limited to 'mm/zswap.c')
0 files changed, 0 insertions, 0 deletions