batman-adv: Return EINVAL on invalid gw_bandwidth change
Invalid speed settings by the user are currently acknowledged as correct but not stored. Instead the return of the store operation of the file "gw_bandwidth" should indicate that the given value is not acceptable. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
This commit is contained in:
parent
a121048a89
commit
77927b7d9d
|
@ -19,6 +19,7 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#include <linux/atomic.h>
|
#include <linux/atomic.h>
|
||||||
|
#include <linux/errno.h>
|
||||||
#include <linux/byteorder/generic.h>
|
#include <linux/byteorder/generic.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/netdevice.h>
|
#include <linux/netdevice.h>
|
||||||
|
@ -160,7 +161,7 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
|
||||||
|
|
||||||
ret = batadv_parse_gw_bandwidth(net_dev, buff, &down_new, &up_new);
|
ret = batadv_parse_gw_bandwidth(net_dev, buff, &down_new, &up_new);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
goto end;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!down_new)
|
if (!down_new)
|
||||||
down_new = 1;
|
down_new = 1;
|
||||||
|
@ -184,7 +185,6 @@ ssize_t batadv_gw_bandwidth_set(struct net_device *net_dev, char *buff,
|
||||||
atomic_set(&bat_priv->gw.bandwidth_up, up_new);
|
atomic_set(&bat_priv->gw.bandwidth_up, up_new);
|
||||||
batadv_gw_tvlv_container_update(bat_priv);
|
batadv_gw_tvlv_container_update(bat_priv);
|
||||||
|
|
||||||
end:
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue