Skip to content

Commit 37255e7

Browse files
committed
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 <[email protected]>
2 parents 10e3cc1 + 6f91a3f commit 37255e7

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

net/batman-adv/bat_v_ogm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,
893893

894894
orig_node = batadv_v_ogm_orig_get(bat_priv, ogm_packet->orig);
895895
if (!orig_node)
896-
return;
896+
goto out;
897897

898898
neigh_node = batadv_neigh_node_get_or_create(orig_node, if_incoming,
899899
ethhdr->h_source);

net/batman-adv/network-coding.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,15 +1009,8 @@ static struct batadv_nc_path *batadv_nc_get_path(struct batadv_priv *bat_priv,
10091009
*/
10101010
static u8 batadv_nc_random_weight_tq(u8 tq)
10111011
{
1012-
u8 rand_val, rand_tq;
1013-
1014-
get_random_bytes(&rand_val, sizeof(rand_val));
1015-
10161012
/* randomize the estimated packet loss (max TQ - estimated TQ) */
1017-
rand_tq = rand_val * (BATADV_TQ_MAX_VALUE - tq);
1018-
1019-
/* normalize the randomized packet loss */
1020-
rand_tq /= BATADV_TQ_MAX_VALUE;
1013+
u8 rand_tq = prandom_u32_max(BATADV_TQ_MAX_VALUE + 1 - tq);
10211014

10221015
/* convert to (randomized) estimated tq again */
10231016
return BATADV_TQ_MAX_VALUE - rand_tq;

net/batman-adv/sysfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ static ssize_t batadv_store_throughput_override(struct kobject *kobj,
11501150
ret = batadv_parse_throughput(net_dev, buff, "throughput_override",
11511151
&tp_override);
11521152
if (!ret)
1153-
return count;
1153+
goto out;
11541154

11551155
old_tp_override = atomic_read(&hard_iface->bat_v.throughput_override);
11561156
if (old_tp_override == tp_override)
@@ -1190,6 +1190,7 @@ static ssize_t batadv_show_throughput_override(struct kobject *kobj,
11901190

11911191
tp_override = atomic_read(&hard_iface->bat_v.throughput_override);
11921192

1193+
batadv_hardif_put(hard_iface);
11931194
return sprintf(buff, "%u.%u MBit\n", tp_override / 10,
11941195
tp_override % 10);
11951196
}

0 commit comments

Comments
 (0)