: Fix off-by-one in max protocol-type check
Subsystems (2)
PATCH 1/1 : Fix off-by-one in max protocol-type check
This patch fixes an off-by-one in inet_register_protosw and inet6_register_protosw. inetsw is an array of size SOCK_MAX, the check allows access to index SOCK_MAX. Patch applies to 2.4 and 2.6.
Regards
Patrick
Quoted 4 lines · Patrick McHardy
This patch fixes an off-by-one in
inet_register_protoswandinet6_register_protosw. inetsw is an array of sizeSOCK_MAX, the check allows access to indexSOCK_MAX. Patch applies to 2.4 and 2.6.
Forgot the patch, sorry ;)
Quoted 4 lines
Regards
Patrick
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/05/28 12:24:03+02:00 [email protected]
# [IPV4,6]: Fix off-by-one in max protocol-type check
#
# net/ipv6/af_inet6.c # 2004/05/28 12:23:56+02:00 [email protected] +1 -1 # [IPV4,6]: Fix off-by-one in max protocol-type check # # net/ipv4/af_inet.c # 2004/05/28 12:23:56+02:00 [email protected] +1 -1 # [IPV4,6]: Fix off-by-one in max protocol-type check # diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c --- a/net/ipv4/af_inet.c 2004-05-28 12:35:06 +02:00 +++ b/net/ipv4/af_inet.c 2004-05-28 12:35:06 +02:00 @@ -978,7 +978,7 @@
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. */
net/ipv6/af_inet6.c +1 -1
@@ -572,7 +572,7 @@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. */
David S. Miller
AppliedQuoted 7 lines · On Fri, 28 May 2004 12:55:57 +0200 Patrick McHardy <[email protected]> wrote:
Quoted 4 lines · Patrick McHardy
This patch fixes an off-by-one in
inet_register_protoswandinet6_register_protosw. inetsw is an array of sizeSOCK_MAX, the check allows access to indexSOCK_MAX. Patch applies to 2.4 and 2.6.Forgot the patch, sorry ;)
Applied.
Hi Dave,
Quoted 7 lines · David S. Miller
Quoted 7 lines
Quoted 4 lines · Patrick McHardy
This patch fixes an off-by-one in
inet_register_protoswandinet6_register_protosw. inetsw is an array of sizeSOCK_MAX, the check allows access to indexSOCK_MAX. Patch applies to 2.4 and 2.6.
Quoted 5 lines
Quoted 1 line
Forgot the patch, sorry ;)
Applied.
Judging from 2.4.27-pre4 changelog, you forgot to apply this patch to 2.4. Patch from 2.6 attached, it applies with some offset.
Regards
Patrick
ChangeSet 1.1763, 2004/05/29 12:38:17-07:00, [email protected]
[IPV4,6]: Fix off-by-one in max protocol-type check
ipv4/af_inet.c | 2 +- ipv6/af_inet6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/af_inet.c +1 -1
@@ -978,7 +978,7 @@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. */
net/ipv6/af_inet6.c +1 -1
@@ -572,7 +572,7 @@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. */
Quoted 3 lines · On Mon, 31 May 2004 01:41:05 +0200 Patrick McHardy <[email protected]> wrote:
Judging from 2.4.27-pre4 changelog, you forgot to apply this patch to 2.4. Patch from 2.6 attached, it applies with some offset.
Good catch, applied to 2.4.x now too.
Thanks.