Skip to content

Commit

Permalink
Merge tag 'batadv-net-for-davem-20200427' of git://git.open-mesh.org/…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
David S. Miller committed Apr 27, 2020
2 parents 10e3cc1 + 6f91a3f commit 37255e7
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion net/batman-adv/bat_v_ogm.c
Original file line number Diff line number Diff line change
@@ -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);
9 changes: 1 addition & 8 deletions net/batman-adv/network-coding.c
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 2 additions & 1 deletion net/batman-adv/sysfs.c
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 37255e7

Please sign in to comment.