Here are some batman-adv bugfixes:

- fix random number generation in network coding, by George Spelvin
 
  - fix reference counter leaks, by Xiyu Yang (3 patches)
 -----BEGIN PGP SIGNATURE-----
 
 iQJKBAABCgA0FiEE1ilQI7G+y+fdhnrfoSvjmEKSnqEFAl6m8zEWHHN3QHNpbW9u
 d3VuZGVybGljaC5kZQAKCRChK+OYQpKeoc4dD/9rKLN853rKJe30QkOBJeinSJOO
 /aEgCbsOVxgLCfvZxdiwSDQRTPFxChXcNZri6cuHu4h7T9ZYcBEKQNRy4D//h9YH
 9wx2+WP7rTKtfScVqOnBf+03fIYzOS9qQnpoA/6id3YIqg5AAhCTB2n5CS1/ILI4
 6WrDfsJH4jgol4Ud+lVAFSokjElxVpQ+5AlcKVTBGli1f4aReu7g3xPSZVIBuikz
 axsO3UEfzLNU+k+Y3Y+/97HWdaEFelIkLoymZSSOxJ/BRX2Dz8M/eUyy/p5iVzb2
 gSF46estgvJodVYrwUEb3UtSSpHP0p562h2QxxjqgayObpJQDwKNeEWkmwHb5RcF
 a8l025LlA9+iW25r/RttXiQ0FoLymY1PCdcsY36MZUXAnFn0UyRv/Zt1CUosoImc
 C9+CA7jM9XlXeipXnHQvNryUcqwsJJI1hUF7WmIRuOAdeqcvNPTzLiCYWAGQmZ4U
 V9CdHQseFKgNnDTaoraW5AMJmuP8frXKcdJd4XWJvOgQO6rX53VTEYqmzqBjFjQZ
 dynAIY1w+REmbqYeROgpp02VVXpXw7LVgKRyQIaDJa0cjXfpgmWATyWuewgLgfyK
 9EGp2Adu4z7QoVRG7I9Uq2UwPuDVPbbKohNgQZsJt98itKkqv1afQ8U83ref6LQO
 5/Mbxke3iQ9ftYVqlg==
 =fNPb
 -----END PGP SIGNATURE-----

Merge tag 'batadv-net-for-davem-20200427' of git://git.open-mesh.org/linux-merge

Simon Wunderlich says:

====================
Here are some batman-adv bugfixes:

 - fix random number generation in network coding, by George Spelvin

 - fix reference counter leaks, by Xiyu Yang (3 patches)
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2020-04-27 13:02:55 -07:00
commit 37255e7a8f
3 changed files with 4 additions and 10 deletions

View File

@ -893,7 +893,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,
orig_node = batadv_v_ogm_orig_get(bat_priv, ogm_packet->orig); orig_node = batadv_v_ogm_orig_get(bat_priv, ogm_packet->orig);
if (!orig_node) if (!orig_node)
return; goto out;
neigh_node = batadv_neigh_node_get_or_create(orig_node, if_incoming, neigh_node = batadv_neigh_node_get_or_create(orig_node, if_incoming,
ethhdr->h_source); ethhdr->h_source);

View File

@ -1009,15 +1009,8 @@ static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv,
*/ */
static u8 batadv_nc_random_weight_tq(u8 tq) static u8 batadv_nc_random_weight_tq(u8 tq)
{ {
u8 rand_val, rand_tq;
get_random_bytes(&rand_val, sizeof(rand_val));
/* randomize the estimated packet loss (max TQ - estimated TQ) */ /* randomize the estimated packet loss (max TQ - estimated TQ) */
rand_tq = rand_val * (BATADV_TQ_MAX_VALUE - tq); u8 rand_tq = prandom_u32_max(BATADV_TQ_MAX_VALUE + 1 - tq);
/* normalize the randomized packet loss */
rand_tq /= BATADV_TQ_MAX_VALUE;
/* convert to (randomized) estimated tq again */ /* convert to (randomized) estimated tq again */
return BATADV_TQ_MAX_VALUE - rand_tq; return BATADV_TQ_MAX_VALUE - rand_tq;

View File

@ -1150,7 +1150,7 @@ static ssize_t batadv_store_throughput_override(struct kobject *kobj,
ret = batadv_parse_throughput(net_dev, buff, "throughput_override", ret = batadv_parse_throughput(net_dev, buff, "throughput_override",
&tp_override); &tp_override);
if (!ret) if (!ret)
return count; goto out;
old_tp_override = atomic_read(&hard_iface->bat_v.throughput_override); old_tp_override = atomic_read(&hard_iface->bat_v.throughput_override);
if (old_tp_override == tp_override) if (old_tp_override == tp_override)
@ -1190,6 +1190,7 @@ static ssize_t batadv_show_throughput_override(struct kobject *kobj,
tp_override = atomic_read(&hard_iface->bat_v.throughput_override); tp_override = atomic_read(&hard_iface->bat_v.throughput_override);
batadv_hardif_put(hard_iface);
return sprintf(buff, "%u.%u MBit\n", tp_override / 10, return sprintf(buff, "%u.%u MBit\n", tp_override / 10,
tp_override % 10); tp_override % 10);
} }