kernel: bump 4.14 to 4.14.72
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 379-cfg80211-initialize-sinfo-in-cfg80211_get_station.patch
1 From 4f717a2589be649afddbbd3ac58b67ebfa7426f7 Mon Sep 17 00:00:00 2001
2 From: Sven Eckelmann <sven@narfation.org>
3 Date: Wed, 6 Jun 2018 10:18:31 +0200
4 Subject: [PATCH v2] cfg80211: initialize sinfo in cfg80211_get_station
5
6 Most of the implementations behind cfg80211_get_station will not initialize
7 sinfo to zero before manipulating it. For example, the member "filled",
8 which indicates the filled in parts of this struct, is often only modified
9 by enabling certain bits in the bitfield while keeping the remaining bits
10 in their original state. A caller without a preinitialized sinfo.filled can
11 then no longer decide which parts of sinfo were filled in by
12 cfg80211_get_station (or actually the underlying implementations).
13
14 cfg80211_get_station must therefore take care that sinfo is initialized to
15 zero. Otherwise, the caller may tries to read information which was not
16 filled in and which must therefore also be considered uninitialized. In
17 batadv_v_elp_get_throughput's case, an invalid "random" expected throughput
18 may be stored for this neighbor and thus the B.A.T.M.A.N V algorithm may
19 switch to non-optimal neighbors for certain destinations.
20
21 Fixes: 7406353d43c8 ("cfg80211: implement cfg80211_get_station cfg80211 API")
22 Reported-by: Thomas Lauer <holminateur@gmail.com>
23 Reported-by: Marcel Schmidt <ff.z-casparistrasse@mailbox.org>
24 Cc: b.a.t.m.a.n@lists.open-mesh.org
25 Signed-off-by: Sven Eckelmann <sven@narfation.org>
26
27 Forwarded: https://patchwork.kernel.org/patch/10449857/
28 ---
29 net/wireless/util.c | 2 ++
30 1 file changed, 2 insertions(+)
31
32 --- a/net/wireless/util.c
33 +++ b/net/wireless/util.c
34 @@ -1749,6 +1749,8 @@ int cfg80211_get_station(struct net_devi
35 if (!rdev->ops->get_station)
36 return -EOPNOTSUPP;
37
38 + memset(sinfo, 0, sizeof(*sinfo));
39 +
40 return rdev_get_station(rdev, dev, mac_addr, sinfo);
41 }
42 EXPORT_SYMBOL(cfg80211_get_station);