Commit 37255e7a authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 10e3cc18 6f91a3f7
...@@ -893,7 +893,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, ...@@ -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);
......
...@@ -1009,15 +1009,8 @@ static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv, ...@@ -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;
......
...@@ -1150,7 +1150,7 @@ static ssize_t batadv_store_throughput_override(struct kobject *kobj, ...@@ -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, ...@@ -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);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment