diff mbox series

batman-adv: batman-adv: handle tvlv unicast send errors

Message ID 20250401083901.2261-1-vulab@iscas.ac.cn (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series batman-adv: batman-adv: handle tvlv unicast send errors | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 0 this patch: 8
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang fail Errors and warnings before: 0 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn fail Errors and warnings before: 0 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Wentao Liang April 1, 2025, 8:39 a.m. UTC
In batadv_tvlv_unicast_send(), the return value of
batadv_send_skb_to_orig() is ignored. This could silently
drop send failures, making it difficult to detect connectivity
issues.

Add error checking for batadv_send_skb_to_orig() and log failures
via batadv_dbg() to improve error visibility.

Fixes: 1ad5bcb2a032 ("batman-adv: Consume skb in batadv_send_skb_to_orig")
Cc: stable@vger.kernel.org # 4.10+
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 net/batman-adv/tvlv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Sven Eckelmann April 1, 2025, 8:48 a.m. UTC | #1
On Tuesday, 1 April 2025 10:39:00 CEST Wentao Liang wrote:
> In batadv_tvlv_unicast_send(), the return value of
> batadv_send_skb_to_orig() is ignored. This could silently
> drop send failures, making it difficult to detect connectivity
> issues.
> 
> Add error checking for batadv_send_skb_to_orig() and log failures
> via batadv_dbg() to improve error visibility.

This looks more like patch you've added for printk-debugging and nothing for 
stable. And you ignore that it can also return things like -EINPROGRESS. Which 
is not an error.

You can also see that this was just for printk-debugging because the error 
class and message has nothing to do with the actual code.

> 
> Fixes: 1ad5bcb2a032 ("batman-adv: Consume skb in batadv_send_skb_to_orig")
> Cc: stable@vger.kernel.org # 4.10+
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  net/batman-adv/tvlv.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/net/batman-adv/tvlv.c b/net/batman-adv/tvlv.c
> index 2a583215d439..f081136cc5b7 100644
> --- a/net/batman-adv/tvlv.c
> +++ b/net/batman-adv/tvlv.c
> @@ -625,6 +625,7 @@ void batadv_tvlv_unicast_send(struct batadv_priv 
*bat_priv, const u8 *src,
>  	unsigned char *tvlv_buff;
>  	unsigned int tvlv_len;
>  	ssize_t hdr_len = sizeof(*unicast_tvlv_packet);
> +	int r;
>  
>  	orig_node = batadv_orig_hash_find(bat_priv, dst);
>  	if (!orig_node)
> @@ -657,7 +658,10 @@ void batadv_tvlv_unicast_send(struct batadv_priv 
*bat_priv, const u8 *src,
>  	tvlv_buff += sizeof(*tvlv_hdr);
>  	memcpy(tvlv_buff, tvlv_value, tvlv_value_len);
>  
> -	batadv_send_skb_to_orig(skb, orig_node, NULL);
> +	r = batadv_send_skb_to_orig(skb, orig_node, NULL);
> +	if (r != NET_XMIT_SUCCESS)
> +		batadv_dbg(BATADV_DBG_TP_METER, bat_priv,
> +			   "Fail to send the ack.");

No, this is definitely the wrong error class. And why do you think that it is 
an ack?
>  out:
>  	batadv_orig_node_put(orig_node);
>  }
> 

Kind regards,
	Sven
diff mbox series

Patch

diff --git a/net/batman-adv/tvlv.c b/net/batman-adv/tvlv.c
index 2a583215d439..f081136cc5b7 100644
--- a/net/batman-adv/tvlv.c
+++ b/net/batman-adv/tvlv.c
@@ -625,6 +625,7 @@  void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, const u8 *src,
 	unsigned char *tvlv_buff;
 	unsigned int tvlv_len;
 	ssize_t hdr_len = sizeof(*unicast_tvlv_packet);
+	int r;
 
 	orig_node = batadv_orig_hash_find(bat_priv, dst);
 	if (!orig_node)
@@ -657,7 +658,10 @@  void batadv_tvlv_unicast_send(struct batadv_priv *bat_priv, const u8 *src,
 	tvlv_buff += sizeof(*tvlv_hdr);
 	memcpy(tvlv_buff, tvlv_value, tvlv_value_len);
 
-	batadv_send_skb_to_orig(skb, orig_node, NULL);
+	r = batadv_send_skb_to_orig(skb, orig_node, NULL);
+	if (r != NET_XMIT_SUCCESS)
+		batadv_dbg(BATADV_DBG_TP_METER, bat_priv,
+			   "Fail to send the ack.");
 out:
 	batadv_orig_node_put(orig_node);
 }