You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
ip_tunnel: Add sanity checks to ip_tunnel_encap_add_ops()
The symbols are exported and could be used by external modules.
Fixes: a8c5f9 ("ip_tunnel: Ops registration for secondary encap (fou, gue)")
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
c9f2c3d36c
commit
bb1553c800
@@ -514,6 +514,9 @@ const struct ip_tunnel_encap_ops __rcu *
|
||||
int ip_tunnel_encap_add_ops(const struct ip_tunnel_encap_ops *ops,
|
||||
unsigned int num)
|
||||
{
|
||||
if (num >= MAX_IPTUN_ENCAP_OPS)
|
||||
return -ERANGE;
|
||||
|
||||
return !cmpxchg((const struct ip_tunnel_encap_ops **)
|
||||
&iptun_encaps[num],
|
||||
NULL, ops) ? 0 : -1;
|
||||
@@ -525,6 +528,9 @@ int ip_tunnel_encap_del_ops(const struct ip_tunnel_encap_ops *ops,
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (num >= MAX_IPTUN_ENCAP_OPS)
|
||||
return -ERANGE;
|
||||
|
||||
ret = (cmpxchg((const struct ip_tunnel_encap_ops **)
|
||||
&iptun_encaps[num],
|
||||
ops, NULL) == ops) ? 0 : -1;
|
||||
|
||||
Reference in New Issue
Block a user