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:
@@ -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);
|
||||
if (!orig_node)
|
||||
return;
|
||||
goto out;
|
||||
|
||||
neigh_node = batadv_neigh_node_get_or_create(orig_node, if_incoming,
|
||||
ethhdr->h_source);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
u8 rand_val, rand_tq;
|
||||
|
||||
get_random_bytes(&rand_val, sizeof(rand_val));
|
||||
|
||||
/* randomize the estimated packet loss (max TQ - estimated TQ) */
|
||||
rand_tq = rand_val * (BATADV_TQ_MAX_VALUE - tq);
|
||||
|
||||
/* normalize the randomized packet loss */
|
||||
rand_tq /= BATADV_TQ_MAX_VALUE;
|
||||
u8 rand_tq = prandom_u32_max(BATADV_TQ_MAX_VALUE + 1 - tq);
|
||||
|
||||
/* convert to (randomized) estimated tq again */
|
||||
return BATADV_TQ_MAX_VALUE - rand_tq;
|
||||
|
||||
@@ -1150,7 +1150,7 @@ static ssize_t batadv_store_throughput_override(struct kobject *kobj,
|
||||
ret = batadv_parse_throughput(net_dev, buff, "throughput_override",
|
||||
&tp_override);
|
||||
if (!ret)
|
||||
return count;
|
||||
goto out;
|
||||
|
||||
old_tp_override = atomic_read(&hard_iface->bat_v.throughput_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);
|
||||
|
||||
batadv_hardif_put(hard_iface);
|
||||
return sprintf(buff, "%u.%u MBit\n", tp_override / 10,
|
||||
tp_override % 10);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user