diff mbox series

[iproute] link_gre6: Detect invalid encaplimit values

Message ID 20171128154958.18403-1-phil@nwl.cc
State Accepted, archived
Delegated to: stephen hemminger
Headers show
Series [iproute] link_gre6: Detect invalid encaplimit values | expand

Commit Message

Phil Sutter Nov. 28, 2017, 3:49 p.m. UTC
Looks like a typo: get_u8() returns 0 on success and -1 on error, so the
error checking here was ineffective.

Fixes: a11b7b71a6eba ("link_gre6: really support encaplimit option")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/link_gre6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas Dichtel Nov. 30, 2017, 1:02 p.m. UTC | #1
Le 28/11/2017 à 16:49, Phil Sutter a écrit :
> Looks like a typo: get_u8() returns 0 on success and -1 on error, so the
> error checking here was ineffective.
> 
> Fixes: a11b7b71a6eba ("link_gre6: really support encaplimit option")
> Signed-off-by: Phil Sutter <phil@nwl.cc>
Good catch!

Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
diff mbox series

Patch

diff --git a/ip/link_gre6.c b/ip/link_gre6.c
index 50c1b804ceca7..0a82eaecf2cdd 100644
--- a/ip/link_gre6.c
+++ b/ip/link_gre6.c
@@ -372,7 +372,7 @@  get_failed:
 			} else {
 				__u8 uval;
 
-				if (get_u8(&uval, *argv, 0) < -1)
+				if (get_u8(&uval, *argv, 0))
 					invarg("invalid ELIM", *argv);
 				encap_limit = uval;
 				flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT;