diff options
| -rw-r--r-- | net/ipv4/ip_tunnel.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index 63e745aadab6..2f498f87e3d8 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
| @@ -514,6 +514,9 @@ const struct ip_tunnel_encap_ops __rcu * | |||
| 514 | int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *ops, | 514 | int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *ops, |
| 515 | unsigned int num) | 515 | unsigned int num) |
| 516 | { | 516 | { |
| 517 | if (num >= MAX_IPTUN_ENCAP_OPS) | ||
| 518 | return -ERANGE; | ||
| 519 | |||
| 517 | return !cmpxchg((const struct ip_tunnel_encap_ops **) | 520 | return !cmpxchg((const struct ip_tunnel_encap_ops **) |
| 518 | &iptun_encaps[num], | 521 | &iptun_encaps[num], |
| 519 | NULL, ops) ? 0 : -1; | 522 | NULL, ops) ? 0 : -1; |
| @@ -525,6 +528,9 @@ int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *ops, | |||
| 525 | { | 528 | { |
| 526 | int ret; | 529 | int ret; |
| 527 | 530 | ||
| 531 | if (num >= MAX_IPTUN_ENCAP_OPS) | ||
| 532 | return -ERANGE; | ||
| 533 | |||
| 528 | ret = (cmpxchg((const struct ip_tunnel_encap_ops **) | 534 | ret = (cmpxchg((const struct ip_tunnel_encap_ops **) |
| 529 | &iptun_encaps[num], | 535 | &iptun_encaps[num], |
| 530 | ops, NULL) == ops) ? 0 : -1; | 536 | ops, NULL) == ops) ? 0 : -1; |
