]> git.neil.brown.name Git - history.git/commitdiff
[IPV4,6]: Fix off-by-one in max protocol-type check
authorPatrick McHardy <kaber@trash.net>
Sat, 29 May 2004 05:38:17 +0000 (22:38 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Sat, 29 May 2004 05:38:17 +0000 (22:38 -0700)
net/ipv4/af_inet.c
net/ipv6/af_inet6.c

index edf45709017806f8f847f652a15706eb2346d912..1cc9ab8fded868e34a8bfafb9e33cd825dcbf6a5 100644 (file)
@@ -978,7 +978,7 @@ void inet_register_protosw(struct inet_protosw *p)
 
        spin_lock_bh(&inetsw_lock);
 
-       if (p->type > SOCK_MAX)
+       if (p->type >= SOCK_MAX)
                goto out_illegal;
 
        /* If we are trying to override a permanent protocol, bail. */
index 24ca03a62f6b0bc23a39787678649d42162e13a7..760ae365d11e482477ed7e06faaf22b02131aa7f 100644 (file)
@@ -572,7 +572,7 @@ inet6_register_protosw(struct inet_protosw *p)
 
        spin_lock_bh(&inetsw6_lock);
 
-       if (p->type > SOCK_MAX)
+       if (p->type >= SOCK_MAX)
                goto out_illegal;
 
        /* If we are trying to override a permanent protocol, bail. */