From 811cb00fa8cdc3f0a7f6eefc000a6888367c8c8f Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 4 Jun 2026 10:58:51 +0200 Subject: batman-adv: tp_meter: initialize last_recv_time during init The last_recv_time is the most important indicator for a receiver session to figure out whether a session timed out or not. But this information was only initialized after the session was added to the tp_receiver_list and after the timer was started. In the worst case, the timer (function) could have tried to access this information before the actual initialization was reached. Like rest of the variables of the tp_meter receiver session, this field has to be filled out before any other (parallel running) context has the chance to access it. Cc: stable@kernel.org Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation") Signed-off-by: Sven Eckelmann --- net/batman-adv/tp_meter.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index 978e32d94e6c..cc72468ca2ab 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -1511,8 +1511,10 @@ batadv_tp_init_recv(struct batadv_priv *bat_priv, tp_vars = batadv_tp_list_find_receiver_session(bat_priv, icmp->orig, icmp->session); - if (tp_vars) + if (tp_vars) { + tp_vars->last_recv_time = jiffies; goto out_unlock; + } if (!atomic_add_unless(&bat_priv->tp_num, 1, BATADV_TP_MAX_NUM)) { batadv_dbg(BATADV_DBG_TP_METER, bat_priv, @@ -1539,6 +1541,8 @@ batadv_tp_init_recv(struct batadv_priv *bat_priv, kref_get(&tp_vars->common.refcount); timer_setup(&tp_vars->common.timer, batadv_tp_receiver_shutdown, 0); + tp_vars->last_recv_time = jiffies; + kref_get(&tp_vars->common.refcount); hlist_add_head_rcu(&tp_vars->common.list, &bat_priv->tp_receiver_list); @@ -1587,9 +1591,9 @@ static void batadv_tp_recv_msg(struct batadv_priv *bat_priv, icmp->orig); goto out; } - } - tp_vars->last_recv_time = jiffies; + tp_vars->last_recv_time = jiffies; + } /* if the packet is a duplicate, it may be the case that an ACK has been * lost. Resend the ACK -- cgit v1.2.3 From e9dc4072c54942c05f6b40f4d1d361ad46f5a0a3 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Tue, 26 May 2026 09:09:32 +0200 Subject: batman-adv: convert cancellation of work items to disable helper With commit 86898fa6b8cd ("workqueue: Implement disable/enable for (delayed) work items"), work queues gained the ability to permanently disallow re-queuing of work items. This is particularly important during object teardown, where a work item must not be re-armed after shutdown begins. Convert all cancel_work_sync() and cancel_delayed_work_sync() call sites to their disable_* equivalents to clarify the intent to prevent re-arming after teardown. Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_iv_ogm.c | 2 +- net/batman-adv/bat_v.c | 2 ++ net/batman-adv/bat_v_elp.c | 6 +++--- net/batman-adv/bat_v_ogm.c | 6 ++++-- net/batman-adv/bridge_loop_avoidance.c | 4 ++-- net/batman-adv/distributed-arp-table.c | 2 +- net/batman-adv/multicast.c | 2 +- net/batman-adv/originator.c | 2 +- net/batman-adv/send.c | 2 +- net/batman-adv/tp_meter.c | 2 +- net/batman-adv/translation-table.c | 2 +- 11 files changed, 18 insertions(+), 14 deletions(-) diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 6f5a468c4084..7588e64e7ba6 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -230,7 +230,7 @@ static void batadv_iv_ogm_iface_disable(struct batadv_hard_iface *hard_iface) mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex); - cancel_delayed_work_sync(&hard_iface->bat_iv.reschedule_work); + disable_delayed_work_sync(&hard_iface->bat_iv.reschedule_work); } static void batadv_iv_ogm_iface_update_mac(struct batadv_hard_iface *hard_iface) diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c index ac2932da5472..cb081038d14f 100644 --- a/net/batman-adv/bat_v.c +++ b/net/batman-adv/bat_v.c @@ -819,6 +819,8 @@ void batadv_v_hardif_init(struct batadv_hard_iface *hard_iface) skb_queue_head_init(&hard_iface->bat_v.aggr_list); INIT_DELAYED_WORK(&hard_iface->bat_v.aggr_wq, batadv_v_ogm_aggr_work); + /* make sure it doesn't run until interface gets enabled */ + disable_delayed_work(&hard_iface->bat_v.aggr_wq); } /** diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index d53485d17220..4841f0f1a9b1 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c @@ -115,7 +115,7 @@ static bool batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh, goto default_throughput; /* only use rtnl_trylock because the elp worker will be cancelled while - * the rntl_lock is held. the cancel_delayed_work_sync() would otherwise + * the rntl_lock is held. the disable_delayed_work_sync() would otherwise * wait forever when the elp work_item was started and it is then also * trying to rtnl_lock */ @@ -162,7 +162,7 @@ static bool batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh, } /* only use rtnl_trylock because the elp worker will be cancelled while - * the rntl_lock is held. the cancel_delayed_work_sync() would otherwise + * the rntl_lock is held. the disable_delayed_work_sync() would otherwise * wait forever when the elp work_item was started and it is then also * trying to rtnl_lock */ @@ -447,7 +447,7 @@ out: */ void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface) { - cancel_delayed_work_sync(&hard_iface->bat_v.elp_wq); + disable_delayed_work_sync(&hard_iface->bat_v.elp_wq); dev_kfree_skb(hard_iface->bat_v.elp_skb); hard_iface->bat_v.elp_skb = NULL; diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index 5936d0048be0..72ae8ffc9db6 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -415,6 +415,8 @@ int batadv_v_ogm_iface_enable(struct batadv_hard_iface *hard_iface) { struct batadv_priv *bat_priv = netdev_priv(hard_iface->mesh_iface); + enable_delayed_work(&hard_iface->bat_v.aggr_wq); + batadv_v_ogm_start_queue_timer(hard_iface); batadv_v_ogm_start_timer(bat_priv); @@ -427,7 +429,7 @@ int batadv_v_ogm_iface_enable(struct batadv_hard_iface *hard_iface) */ void batadv_v_ogm_iface_disable(struct batadv_hard_iface *hard_iface) { - cancel_delayed_work_sync(&hard_iface->bat_v.aggr_wq); + disable_delayed_work_sync(&hard_iface->bat_v.aggr_wq); spin_lock_bh(&hard_iface->bat_v.aggr_list.lock); batadv_v_ogm_aggr_list_free(hard_iface); @@ -1080,7 +1082,7 @@ int batadv_v_ogm_init(struct batadv_priv *bat_priv) */ void batadv_v_ogm_free(struct batadv_priv *bat_priv) { - cancel_delayed_work_sync(&bat_priv->bat_v.ogm_wq); + disable_delayed_work_sync(&bat_priv->bat_v.ogm_wq); mutex_lock(&bat_priv->bat_v.ogm_buff_mutex); diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 0461f11227d0..0bd24a19ff20 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -1282,7 +1282,7 @@ purge_now: if (purged) { /* reference for pending report_work */ - if (cancel_work_sync(&backbone_gw->report_work)) + if (disable_work_sync(&backbone_gw->report_work)) batadv_backbone_gw_put(backbone_gw); /* reference for hash_entry */ @@ -1850,7 +1850,7 @@ void batadv_bla_free(struct batadv_priv *bat_priv) { struct batadv_hard_iface *primary_if; - cancel_delayed_work_sync(&bat_priv->bla.work); + disable_delayed_work_sync(&bat_priv->bla.work); primary_if = batadv_primary_if_get_selected(bat_priv); if (bat_priv->bla.claim_hash) { diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 0b02018c5b85..aaea155b9403 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -838,7 +838,7 @@ void batadv_dat_free(struct batadv_priv *bat_priv) batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_DAT, 1); batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_DAT, 1); - cancel_delayed_work_sync(&bat_priv->dat.work); + disable_delayed_work_sync(&bat_priv->dat.work); batadv_dat_hash_free(bat_priv); } diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c index 3274e2ac4f4a..1c5315e55c04 100644 --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c @@ -2161,7 +2161,7 @@ int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb) */ void batadv_mcast_free(struct batadv_priv *bat_priv) { - cancel_delayed_work_sync(&bat_priv->mcast.work); + disable_delayed_work_sync(&bat_priv->mcast.work); batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 2); batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST_TRACKER, 1); diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 15d660ca7937..b161232c1088 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c @@ -908,7 +908,7 @@ void batadv_originator_free(struct batadv_priv *bat_priv) if (!hash) return; - cancel_delayed_work_sync(&bat_priv->orig_work); + disable_delayed_work_sync(&bat_priv->orig_work); bat_priv->orig_hash = NULL; diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 5f9da3606a8f..7f449338a490 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c @@ -629,7 +629,7 @@ static void batadv_forw_packet_list_free(struct hlist_head *head) hlist_for_each_entry_safe(forw_packet, safe_tmp_node, head, cleanup_list) { - cancel_delayed_work_sync(&forw_packet->delayed_work); + disable_delayed_work_sync(&forw_packet->delayed_work); hlist_del(&forw_packet->cleanup_list); batadv_forw_packet_free(forw_packet, true); diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index cc72468ca2ab..a404d70e053e 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -421,7 +421,7 @@ static bool batadv_tp_list_detach(struct batadv_tp_vars_common *tp_vars) */ static void batadv_tp_sender_cleanup(struct batadv_tp_sender *tp_vars) { - cancel_delayed_work_sync(&tp_vars->finish_work); + disable_delayed_work_sync(&tp_vars->finish_work); if (batadv_tp_list_detach(&tp_vars->common)) batadv_tp_sender_put(tp_vars); diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index c346e43d47b9..8b6c49c32c89 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -3574,7 +3574,7 @@ void batadv_tt_free(struct batadv_priv *bat_priv) batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1); batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1); - cancel_delayed_work_sync(&bat_priv->tt.work); + disable_delayed_work_sync(&bat_priv->tt.work); batadv_tt_local_table_free(bat_priv); batadv_tt_global_table_free(bat_priv); -- cgit v1.2.3 From b2e44a67ef4fb9593ea60c8c27f637bdeab40f09 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Tue, 2 Jun 2026 17:41:15 +0200 Subject: batman-adv: drop duplicated wifi_flags assignments During the initialization of the batadv_wifi_net_device_state, it is enough to write the wifi_flags once before the batadv_wifi_net_device_state is added to the batadv_wifi_net_devices rhashtable. Signed-off-by: Sven Eckelmann --- net/batman-adv/hard-interface.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 43ebf86e7b36..96b8130375a3 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -987,7 +987,6 @@ batadv_wifi_net_device_insert(struct net_device *net_dev, u32 wifi_flags) if (!device_state) return -ENOMEM; - device_state->wifi_flags = wifi_flags; netdev_hold(net_dev, &device_state->dev_tracker, GFP_ATOMIC); device_state->netdev = net_dev; WRITE_ONCE(device_state->wifi_flags, wifi_flags); -- cgit v1.2.3 From ed497f64a617b0ecdc751c57f296bb7dc4b435c4 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Tue, 2 Jun 2026 17:46:10 +0200 Subject: batman-adv: use GFP_KERNEL allocations for the wifi detection cache The batadv_wifi_net_device_insert() is called with ASSERT_RTNL() held, but not inside a spinlock or another context which prevents "might_sleep" functions. To relax the requirements for the allocator, use GFP_KERNEL. Signed-off-by: Sven Eckelmann --- net/batman-adv/hard-interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 96b8130375a3..04b227ec8052 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -983,11 +983,11 @@ batadv_wifi_net_device_insert(struct net_device *net_dev, u32 wifi_flags) ASSERT_RTNL(); - device_state = kzalloc_obj(*device_state, GFP_ATOMIC); + device_state = kzalloc_obj(*device_state, GFP_KERNEL); if (!device_state) return -ENOMEM; - netdev_hold(net_dev, &device_state->dev_tracker, GFP_ATOMIC); + netdev_hold(net_dev, &device_state->dev_tracker, GFP_KERNEL); device_state->netdev = net_dev; WRITE_ONCE(device_state->wifi_flags, wifi_flags); -- cgit v1.2.3 From bb9e48e32d31d3cf12176da81334f345792ac96b Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Wed, 3 Jun 2026 10:47:53 +0200 Subject: batman-adv: document cleanup of batadv_wifi_net_devices entries It doesn't seem to be obvious how the entries from the batadv_wifi_net_devices rhashtable are getting removed before the actual rhashtable is destroyed. Document the idea behind the process and which steps are involved. Signed-off-by: Sven Eckelmann --- net/batman-adv/hard-interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 04b227ec8052..e2c85bd8dbb5 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -1185,5 +1185,9 @@ int __init batadv_wifi_net_devices_init(void) */ void batadv_wifi_net_devices_deinit(void) { + /* just destroy table. entries should have been removed by + * unregister_netdevice_notifier() and the corresponding + * NETDEV_UNREGISTER events + */ rhashtable_destroy(&batadv_wifi_net_devices); } -- cgit v1.2.3 From 0e8c38fe9f5009b82c96d6757f7ac98f30d76ab6 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Tue, 2 Jun 2026 17:39:16 +0200 Subject: batman-adv: correct batadv_wifi_* kernel-doc The original kernel documentation for the batadv_wifi_* functions contained copy+paste errors. Correct them to make it easier understandable. Signed-off-by: Sven Eckelmann --- net/batman-adv/hard-interface.c | 6 +++--- net/batman-adv/hard-interface.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index e2c85bd8dbb5..60cee2c2f2f4 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -971,9 +971,9 @@ static int batadv_hard_if_event_meshif(unsigned long event, /** * batadv_wifi_net_device_insert() - save information about wifi net_device * @net_dev: net_device to add to batadv_wifi_net_devices - * @wifi_flags: net_device which generated an event + * @wifi_flags: extracted batadv_hard_iface_wifi_flags of a net_device * - * Return: 0 on result, negative value on error + * Return: 0 on success, negative value on error */ static int batadv_wifi_net_device_insert(struct net_device *net_dev, u32 wifi_flags) @@ -1006,7 +1006,7 @@ err_free: /** * batadv_wifi_net_device_remove() - remove information about wifi net_device - * @device_state: wifi net_device state to remove from batadv_wifi_net_device_state + * @device_state: wifi net_device state to remove from batadv_wifi_net_devices */ static void batadv_wifi_net_device_remove(struct batadv_wifi_net_device_state *device_state) diff --git a/net/batman-adv/hard-interface.h b/net/batman-adv/hard-interface.h index 822e7e378c4d..af31696c3978 100644 --- a/net/batman-adv/hard-interface.h +++ b/net/batman-adv/hard-interface.h @@ -126,7 +126,7 @@ out: /** * batadv_is_cfg80211() - check if the given hardif is a cfg80211 * wifi interface - * @wifi_flags: extracted batadv_hard_iface_wifi_flagss of an net_device + * @wifi_flags: extracted batadv_hard_iface_wifi_flags of a net_device * * Return: true if the net device is a cfg80211 wireless device, false * otherwise. @@ -143,7 +143,7 @@ static inline bool batadv_is_cfg80211(u32 wifi_flags) /** * batadv_is_wifi() - check if flags belong to wifi interface - * @wifi_flags: extracted batadv_hard_iface_wifi_flagss of an net_device + * @wifi_flags: extracted batadv_hard_iface_wifi_flags of a net_device * * Return: true if the net device is a 802.11 wireless device, false otherwise. */ -- cgit v1.2.3 From 0c0f658d9abd6ea364c2a557edd3af5eb93f67a3 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 4 Jun 2026 11:09:04 +0200 Subject: batman-adv: tp_meter: update stale kernel-doc after refactoring The tp_meter codebase was recently refactored: * throughput meter sender and receiver variables were split into two different structures * the congestion control variables were extracted in a separate structure But the kernel-doc was not updated everywhere to reflect these changes. Signed-off-by: Sven Eckelmann --- net/batman-adv/tp_meter.c | 16 ++++++++-------- net/batman-adv/types.h | 14 ++++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index a404d70e053e..7e98cbfbbb70 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -289,7 +289,7 @@ batadv_tp_list_find_sender(struct batadv_priv *bat_priv, const u8 *dst) * @bat_priv: the bat priv with all the mesh interface information * @dst: the other endpoint MAC address to look for * - * Return: if matching session with @dst was found + * Return: true if a matching session with @dst was found, false otherwise */ static bool batadv_tp_list_active(struct batadv_priv *bat_priv, const u8 *dst) __must_hold(&bat_priv->tp_list_lock) @@ -355,7 +355,7 @@ batadv_tp_list_find_sender_session(struct batadv_priv *bat_priv, const u8 *dst, /** * batadv_tp_vars_common_release() - release batadv_tp_vars_common from lists * and queue for free after rcu grace period - * @ref: kref pointer of the batadv_tp_vars + * @ref: kref pointer of the batadv_tp_vars_common */ static void batadv_tp_vars_common_release(struct kref *ref) { @@ -391,7 +391,7 @@ static void batadv_tp_sender_put(struct batadv_tp_sender *tp_vars) } /** - * batadv_tp_list_detach() - remove tp receiver session from mesh session list once + * batadv_tp_list_detach() - remove tp session from mesh session list once * @tp_vars: the private data of the current TP meter session * * Return: whether tp_vars was detached from list and reference must be freed @@ -509,7 +509,7 @@ static void batadv_tp_sender_finish(struct work_struct *work) * batadv_tp_reset_sender_timer() - reschedule the sender timer * @tp_vars: the private TP meter data for this session * - * Reschedule the timer using tp_vars->rto as delay + * Reschedule the timer using tp_vars->cc.rto as delay */ static void batadv_tp_reset_sender_timer(struct batadv_tp_sender *tp_vars) { @@ -621,9 +621,9 @@ static void batadv_tp_fill_prerandom(struct batadv_tp_sender *tp_vars, * * Create and send a single TP Meter message. * - * Return: 0 on success, BATADV_TP_REASON_DST_UNREACHABLE if the destination is - * not reachable, BATADV_TP_REASON_MEMORY_ERROR if the packet couldn't be - * allocated + * Return: 0 on success, BATADV_TP_REASON_MEMORY_ERROR if the packet couldn't + * be allocated, BATADV_TP_REASON_CANT_SEND if the packet could not be + * transmitted */ static int batadv_tp_send_msg(struct batadv_tp_sender *tp_vars, const u8 *src, struct batadv_orig_node *orig_node, @@ -913,7 +913,7 @@ static int batadv_tp_wait_available(struct batadv_tp_sender *tp_vars, size_t ple * batadv_tp_send() - main sending thread of a tp meter session * @arg: address of the related tp_vars * - * Return: nothing, this function never returns + * Return: 0 */ static int batadv_tp_send(void *arg) { diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index 5eb0371def83..a7fa0d9e0928 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h @@ -1331,7 +1331,7 @@ struct batadv_tp_unacked { /** @len: length of the packet */ u16 len; - /** @list: list node for &batadv_tp_vars.unacked_list */ + /** @list: list node for &batadv_tp_vars_common.unacked_list */ struct list_head list; }; @@ -1367,7 +1367,9 @@ struct batadv_tp_vars_common { struct rcu_head rcu; }; -/** struct batadv_tp_sender_cc - congestion control variables */ +/** + * struct batadv_tp_sender_cc - congestion control variables + */ struct batadv_tp_sender_cc { /** @fast_recovery: true if in Fast Recovery mode */ bool fast_recovery:1; @@ -1410,7 +1412,7 @@ struct batadv_tp_sender_cc { * struct batadv_tp_sender - sender tp meter private variables per session */ struct batadv_tp_sender { - /** @common: common batadv_tp_vars (best be first member) */ + /** @common: common batadv_tp_vars_common (must be first member) */ struct batadv_tp_vars_common common; /** @start_time: start time in jiffies */ @@ -1437,7 +1439,7 @@ struct batadv_tp_sender { /** @cc: congestion control variables */ struct batadv_tp_sender_cc cc; - /** @cc_lock: lock do protect @cc */ + /** @cc_lock: lock to protect @cc */ spinlock_t cc_lock; /** @tot_sent: amount of data sent/ACKed so far */ @@ -1460,7 +1462,7 @@ struct batadv_tp_sender { * struct batadv_tp_receiver - receiver tp meter private variables per session */ struct batadv_tp_receiver { - /** @common: common batadv_tp_vars (best be first member) */ + /** @common: common batadv_tp_vars_common (must be first member) */ struct batadv_tp_vars_common common; /** @receiving: receiving binary semaphore: 1 if receiving, 0 is not */ @@ -1662,7 +1664,7 @@ struct batadv_priv { /** @forw_bcast_list_lock: lock protecting forw_bcast_list */ spinlock_t forw_bcast_list_lock; - /** @tp_list_lock: spinlock protecting @tp_list */ + /** @tp_list_lock: spinlock protecting @tp_sender_list + @tp_receiver_list */ spinlock_t tp_list_lock; /** @tp_num: number of currently active tp sessions */ -- cgit v1.2.3 From 219b4c46db7fe9627c3ab30e0cfe1a79ca808995 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 4 Jun 2026 21:35:04 +0200 Subject: batman-adv: bla: update stale kernel-doc The bridge-loop-avoidance code was changed recently to avoid inconsistent state and race condition problems. The kernel-doc addded in these commits (and related code) has various minor deficits which are now resolved. Signed-off-by: Sven Eckelmann --- net/batman-adv/bridge_loop_avoidance.c | 2 +- net/batman-adv/bridge_loop_avoidance.h | 2 +- net/batman-adv/types.h | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 0bd24a19ff20..5c73f6ba16cf 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -123,7 +123,7 @@ static bool batadv_compare_backbone_gw(const struct hlist_node *node, * @node: list node of the first entry to compare * @data2: pointer to the second claims * - * Return: true if the claim have the same data, 0 otherwise + * Return: true if the claims have the same data, false otherwise */ static bool batadv_compare_claim(const struct hlist_node *node, const void *data2) diff --git a/net/batman-adv/bridge_loop_avoidance.h b/net/batman-adv/bridge_loop_avoidance.h index 8673a265995f..06c7dfb8c677 100644 --- a/net/batman-adv/bridge_loop_avoidance.h +++ b/net/batman-adv/bridge_loop_avoidance.h @@ -21,7 +21,7 @@ * detect frame sent by bridge loop avoidance * @mac: mac address to check * - * Return: true if the it looks like a loop detect frame + * Return: true if it looks like a loop detect frame * (mac starts with BA:BE), false otherwise */ static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac) diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index a7fa0d9e0928..5fd5bd358a24 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h @@ -1723,22 +1723,26 @@ struct batadv_priv { #ifdef CONFIG_BATMAN_ADV_BLA +/** + * enum batadv_bla_backbone_gw_state - state of a bridge loop avoidance + * backbone gateway + */ enum batadv_bla_backbone_gw_state { /** * @BATADV_BLA_BACKBONE_GW_STOPPED: backbone gw is being removed - * and it must not longer work on requests + * and it must no longer work on requests */ BATADV_BLA_BACKBONE_GW_STOPPED, /** * @BATADV_BLA_BACKBONE_GW_UNSYNCED: backbone was detected out - * of sync and a request was send. No traffic is forwarded until the + * of sync and a request was sent. No traffic is forwarded until the * situation is resolved */ BATADV_BLA_BACKBONE_GW_UNSYNCED, /** - * @BATADV_BLA_BACKBONE_GW_SYNCED: backbone is consider to be in + * @BATADV_BLA_BACKBONE_GW_SYNCED: backbone is considered to be in * sync. traffic can be forwarded */ BATADV_BLA_BACKBONE_GW_SYNCED, -- cgit v1.2.3 From f3ff3eb0d6a4080fa7f554b8478a3405b8e4befe Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 4 Jun 2026 21:58:31 +0200 Subject: batman-adv: uapi: keep kernel-doc in struct member order The order of the members of struct batadv_coded_packet and struct batadv_unicast_tvlv_packet didn't match the kernel doc. This is the case for all other structures and should also be done the same way for these two. Signed-off-by: Sven Eckelmann --- include/uapi/linux/batadv_packet.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/batadv_packet.h b/include/uapi/linux/batadv_packet.h index 439132a819ea..1241285b866c 100644 --- a/include/uapi/linux/batadv_packet.h +++ b/include/uapi/linux/batadv_packet.h @@ -518,16 +518,16 @@ struct batadv_mcast_packet { * @packet_type: batman-adv packet type, part of the general header * @version: batman-adv protocol version, part of the general header * @ttl: time to live for this packet, part of the general header + * @first_ttvn: tt-version number of first included packet * @first_source: original source of first included packet * @first_orig_dest: original destination of first included packet * @first_crc: checksum of first included packet - * @first_ttvn: tt-version number of first included packet * @second_ttl: ttl of second packet + * @second_ttvn: tt version number of second included packet * @second_dest: second receiver of this coded packet * @second_source: original source of second included packet * @second_orig_dest: original destination of second included packet * @second_crc: checksum of second included packet - * @second_ttvn: tt version number of second included packet * @coded_len: length of network coded part of the payload */ struct batadv_coded_packet { @@ -554,8 +554,8 @@ struct batadv_coded_packet { * @version: batman-adv protocol version, part of the general header * @ttl: time to live for this packet, part of the general header * @reserved: reserved field (for packet alignment) - * @src: address of the source * @dst: address of the destination + * @src: address of the source * @tvlv_len: length of tvlv data following the unicast tvlv header * @align: 2 bytes to align the header to a 4 byte boundary */ -- cgit v1.2.3 From 7b915cd40bb2786122d5e336d7bdf46e5d94af70 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 4 Jun 2026 22:00:46 +0200 Subject: batman-adv: fix batadv_v_ogm_packet_recv error handling kernel-doc All receive handlers in batman-adv are consuming the skbuff independent of the result of the handler. The "(without freeing the skb) on failure" is therefore not corrrect anymore for the current implementation. Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_v_ogm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index 72ae8ffc9db6..14920f4bb315 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -984,7 +984,7 @@ out: * @if_incoming: the interface where this OGM has been received * * Return: NET_RX_SUCCESS and consume the skb on success or returns NET_RX_DROP - * (without freeing the skb) on failure + * (freeing the skb) on failure */ int batadv_v_ogm_packet_recv(struct sk_buff *skb, struct batadv_hard_iface *if_incoming) -- cgit v1.2.3 From 1e2fa2b10c234578d3c98c70f89c04a7aba4db92 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Thu, 4 Jun 2026 21:35:52 +0200 Subject: batman-adv: fix kernel-doc typos and grammar errors Various minor errors were gathered over the time in batman-adv's kernel-doc comments. Get rid of many of them before they are copied (again) to new functions. Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_v.c | 2 +- net/batman-adv/bat_v_ogm.c | 8 ++++---- net/batman-adv/bitarray.c | 2 +- net/batman-adv/bitarray.h | 2 +- net/batman-adv/fragmentation.c | 3 ++- net/batman-adv/hash.h | 4 ++-- net/batman-adv/mesh-interface.c | 6 +++--- net/batman-adv/netlink.c | 4 ++-- net/batman-adv/originator.c | 4 ++-- net/batman-adv/tvlv.c | 4 ++-- 10 files changed, 20 insertions(+), 19 deletions(-) diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c index cb081038d14f..fe7c0113d0df 100644 --- a/net/batman-adv/bat_v.c +++ b/net/batman-adv/bat_v.c @@ -587,7 +587,7 @@ next: } /** - * batadv_v_gw_is_eligible() - check if a originator would be selected as GW + * batadv_v_gw_is_eligible() - check if an originator would be selected as GW * @bat_priv: the bat priv with all the mesh interface information * @curr_gw_orig: originator representing the currently selected GW * @orig_node: the originator representing the new candidate diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index 14920f4bb315..81926ef9c02c 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -515,7 +515,7 @@ static u32 batadv_v_forward_penalty(struct batadv_priv *bat_priv, * @bat_priv: the bat priv with all the mesh interface information * @ogm_received: previously received OGM to be forwarded * @orig_node: the originator which has been updated - * @neigh_node: the neigh_node through with the OGM has been received + * @neigh_node: the neigh_node through which the OGM has been received * @if_incoming: the interface on which this OGM was received on * @if_outgoing: the interface to which the OGM has to be forwarded to * @@ -602,7 +602,7 @@ out: * @bat_priv: the bat priv with all the mesh interface information * @ogm2: OGM2 structure * @orig_node: Originator structure for which the OGM has been received - * @neigh_node: the neigh_node through with the OGM has been received + * @neigh_node: the neigh_node through which the OGM has been received * @if_incoming: the interface where this packet was received * @if_outgoing: the interface for which the packet should be considered * @@ -686,7 +686,7 @@ out: * @ethhdr: the Ethernet header of the OGM2 * @ogm2: OGM2 structure * @orig_node: Originator structure for which the OGM has been received - * @neigh_node: the neigh_node through with the OGM has been received + * @neigh_node: the neigh_node through which the OGM has been received * @if_incoming: the interface where this packet was received * @if_outgoing: the interface for which the packet should be considered * @@ -781,7 +781,7 @@ out: * @ethhdr: the Ethernet header of the OGM2 * @ogm2: OGM2 structure * @orig_node: Originator structure for which the OGM has been received - * @neigh_node: the neigh_node through with the OGM has been received + * @neigh_node: the neigh_node through which the OGM has been received * @if_incoming: the interface where this packet was received * @if_outgoing: the interface for which the packet should be considered */ diff --git a/net/batman-adv/bitarray.c b/net/batman-adv/bitarray.c index 2c49b2711650..67cb356332bf 100644 --- a/net/batman-adv/bitarray.c +++ b/net/batman-adv/bitarray.c @@ -24,7 +24,7 @@ static void batadv_bitmap_shift_left(unsigned long *seq_bits, s32 n) * batadv_bit_get_packet() - receive and process one packet within the sequence * number window * @priv: the bat priv with all the mesh interface information - * @seq_bits: pointer to the sequence number receive packet + * @seq_bits: pointer to the sequence number bitmap of received packets * @seq_num_diff: difference between the current/received sequence number and * the last sequence number * @set_mark: whether this packet should be marked in seq_bits diff --git a/net/batman-adv/bitarray.h b/net/batman-adv/bitarray.h index 37f7ae413bc6..2b9f5dbb3ec4 100644 --- a/net/batman-adv/bitarray.h +++ b/net/batman-adv/bitarray.h @@ -17,7 +17,7 @@ /** * batadv_test_bit() - check if bit is set in the current window * - * @seq_bits: pointer to the sequence number receive packet + * @seq_bits: pointer to the sequence number bitmap of received packets * @last_seqno: latest sequence number in seq_bits * @curr_seqno: sequence number to test for * diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index 14ccf7811bf6..1e42cf99f8b3 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c @@ -309,7 +309,8 @@ free: * batadv_skb_is_frag() - check if newly merged skb contains unicast fragment * @skb: newly merged skb * - * Return: if newly merged skb is of type BATADV_UNICAST_FRAG + * Return: true if the newly merged skb is of type BATADV_UNICAST_FRAG, false + * otherwise */ static bool batadv_skb_is_frag(struct sk_buff *skb) { diff --git a/net/batman-adv/hash.h b/net/batman-adv/hash.h index fb251c385a1b..86a2c20000dc 100644 --- a/net/batman-adv/hash.h +++ b/net/batman-adv/hash.h @@ -120,10 +120,10 @@ out: * @choose: callback calculating the hash index * @data: data passed to the aforementioned callbacks as argument * - * ata could be the structure you use with just the key filled, we just need + * data could be the structure you use with just the key filled, we just need * the key for comparing. * - * Return: returns pointer do data on success, so you can remove the used + * Return: returns pointer to data on success, so you can remove the used * structure yourself, or NULL on error */ static inline void *batadv_hash_remove(struct batadv_hashtable *hash, diff --git a/net/batman-adv/mesh-interface.c b/net/batman-adv/mesh-interface.c index b6797654b18a..44026810b99c 100644 --- a/net/batman-adv/mesh-interface.c +++ b/net/batman-adv/mesh-interface.c @@ -392,13 +392,13 @@ end: * @orig_node: originator from which the batman-adv packet was sent * * Sends an ethernet frame to the receive path of the local @mesh_iface. - * skb->data has still point to the batman-adv header with the size @hdr_size. + * skb->data must still point to the batman-adv header with the size @hdr_size. * The caller has to have parsed this header already and made sure that at least * @hdr_size bytes are still available for pull in @skb. * * The packet may still get dropped. This can happen when the encapsulated - * ethernet frame is invalid or contains again an batman-adv packet. Also - * unicast packets will be dropped directly when it was sent between two + * ethernet frame is invalid or contains again a batman-adv packet. Also + * unicast packets will be dropped directly when they were sent between two * isolated clients. */ void batadv_interface_rx(struct net_device *mesh_iface, diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index 1ba206e40273..4cf9e3c54ad3 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -944,7 +944,7 @@ static int batadv_netlink_set_hardif(struct sk_buff *skb, } /** - * batadv_netlink_dump_hardif() - Dump all hard interface into a messages + * batadv_netlink_dump_hardif() - Dump all hard interfaces into a message * @msg: Netlink message to dump into * @cb: Parameters from query * @@ -1101,7 +1101,7 @@ static int batadv_netlink_get_vlan(struct sk_buff *skb, struct genl_info *info) } /** - * batadv_netlink_set_vlan() - Get vlan attributes + * batadv_netlink_set_vlan() - Set vlan attributes * @skb: Netlink message with request data * @info: receiver information * diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index b161232c1088..9b38bd9e8da7 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c @@ -439,7 +439,7 @@ out: } /** - * batadv_neigh_ifinfo_get() - find the ifinfo from an neigh_node + * batadv_neigh_ifinfo_get() - find the ifinfo from a neigh_node * @neigh: the neigh node to be queried * @if_outgoing: the interface for which the ifinfo should be acquired * @@ -472,7 +472,7 @@ batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh, } /** - * batadv_neigh_ifinfo_new() - search and possibly create an neigh_ifinfo object + * batadv_neigh_ifinfo_new() - search and possibly create a neigh_ifinfo object * @neigh: the neigh node to be queried * @if_outgoing: the interface for which the ifinfo should be acquired * diff --git a/net/batman-adv/tvlv.c b/net/batman-adv/tvlv.c index cd75daea478c..403c85456870 100644 --- a/net/batman-adv/tvlv.c +++ b/net/batman-adv/tvlv.c @@ -48,7 +48,7 @@ static void batadv_tvlv_handler_release(struct kref *ref) } /** - * batadv_tvlv_handler_put() - decrement the tvlv container refcounter and + * batadv_tvlv_handler_put() - decrement the tvlv handler refcounter and * possibly release it * @tvlv_handler: the tvlv handler to free */ @@ -272,7 +272,7 @@ void batadv_tvlv_container_register(struct batadv_priv *bat_priv, * @additional_packet_len: requested additional packet size on top of minimum * size * - * Return: true of the packet buffer could be changed to the requested size, + * Return: true if the packet buffer could be changed to the requested size, * false otherwise. */ static bool batadv_tvlv_realloc_packet_buff(struct batadv_ogm_buf *ogm_buff, -- cgit v1.2.3