batman-adv: fix returned error in batadv_netlink_tp_meter_cancel

Message ID 1463770180-4030-1-git-send-email-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit f0aae6bb43539b299481bb79366d5c3d769ed522
Delegated to: Marek Lindner
Headers

Commit Message

Sven Eckelmann May 20, 2016, 6:49 p.m. UTC
  From: Simon Wunderlich <sw@simonwunderlich.de>

The BATADV_CMD_TP_METER_CANCEL netlink cmd can for example fail when no
valid soft_iface can be found. This error should not only detected but
also be reported back to the caller.

Fixes: 98d7a766b645 ("batman-adv: throughput meter implementation")
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/netlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Marek Lindner June 6, 2016, 4:07 p.m. UTC | #1
On Friday, May 20, 2016 20:49:40 Sven Eckelmann wrote:
> From: Simon Wunderlich <sw@simonwunderlich.de>
> 
> The BATADV_CMD_TP_METER_CANCEL netlink cmd can for example fail when no
> valid soft_iface can be found. This error should not only detected but
> also be reported back to the caller.
> 
> Fixes: 98d7a766b645 ("batman-adv: throughput meter implementation")
> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  net/batman-adv/netlink.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied in revision f0aae6b.

Thanks,
Marek
  

Patch

diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c
index 56e63ce..c25bbb8 100644
--- a/net/batman-adv/netlink.c
+++ b/net/batman-adv/netlink.c
@@ -350,7 +350,7 @@  batadv_netlink_tp_meter_cancel(struct sk_buff *skb, struct genl_info *info)
 	struct batadv_priv *bat_priv;
 	int ifindex;
 	u8 *dst;
-	int ret;
+	int ret = 0;
 
 	if (!info->attrs[BATADV_ATTR_MESH_IFINDEX])
 		return -EINVAL;
@@ -377,7 +377,7 @@  out:
 	if (soft_iface)
 		dev_put(soft_iface);
 
-	return 0;
+	return ret;
 }
 
 static struct genl_ops batadv_netlink_ops[] = {