netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: Fix off-by-one in max protocol-type check
@ 2004-05-28 10:53 Patrick McHardy
  2004-05-28 10:55 ` Patrick McHardy
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2004-05-28 10:53 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]: Fix off-by-one in max protocol-type check
  2004-05-28 10:53 [PATCH]: Fix off-by-one in max protocol-type check Patrick McHardy
@ 2004-05-28 10:55 ` Patrick McHardy
  2004-05-29 19:38   ` David S. Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2004-05-28 10:55 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

Patrick McHardy wrote:
> 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.

Forgot the patch, sorry ;)


> 
> Regards
> Patrick
> 


[-- Attachment #2: protocol-type-off-by-one.diff --]
[-- Type: text/x-patch, Size: 1147 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/05/28 12:24:03+02:00 kaber@trash.net 
#   [IPV4,6]: Fix off-by-one in max protocol-type check
# 
# net/ipv6/af_inet6.c
#   2004/05/28 12:23:56+02:00 kaber@trash.net +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 kaber@trash.net +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. */
diff -Nru a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
--- a/net/ipv6/af_inet6.c	2004-05-28 12:35:06 +02:00
+++ b/net/ipv6/af_inet6.c	2004-05-28 12:35:06 +02:00
@@ -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. */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]: Fix off-by-one in max protocol-type check
  2004-05-28 10:55 ` Patrick McHardy
@ 2004-05-29 19:38   ` David S. Miller
  2004-05-30 23:41     ` Patrick McHardy
  0 siblings, 1 reply; 5+ messages in thread
From: David S. Miller @ 2004-05-29 19:38 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netdev

On Fri, 28 May 2004 12:55:57 +0200
Patrick McHardy <kaber@trash.net> wrote:

> Patrick McHardy wrote:
> > 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.
> 
> Forgot the patch, sorry ;)

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]: Fix off-by-one in max protocol-type check
  2004-05-29 19:38   ` David S. Miller
@ 2004-05-30 23:41     ` Patrick McHardy
  2004-05-30 23:59       ` David S. Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2004-05-30 23:41 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

Hi Dave,

David S. Miller wrote:
>>Patrick McHardy wrote:
>>
>>>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.
>>
>>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

[-- Attachment #2: protocol-type-off-by-one.diff --]
[-- Type: text/x-patch, Size: 931 bytes --]

ChangeSet 1.1763, 2004/05/29 12:38:17-07:00, kaber@trash.net

	[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(-)


diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
--- a/net/ipv4/af_inet.c	2004-05-29 14:14:46 -07:00
+++ b/net/ipv4/af_inet.c	2004-05-29 14:14:46 -07: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. */
diff -Nru a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
--- a/net/ipv6/af_inet6.c	2004-05-29 14:14:46 -07:00
+++ b/net/ipv6/af_inet6.c	2004-05-29 14:14:46 -07:00
@@ -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. */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH]: Fix off-by-one in max protocol-type check
  2004-05-30 23:41     ` Patrick McHardy
@ 2004-05-30 23:59       ` David S. Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2004-05-30 23:59 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netdev

On Mon, 31 May 2004 01:41:05 +0200
Patrick McHardy <kaber@trash.net> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-05-30 23:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-28 10:53 [PATCH]: Fix off-by-one in max protocol-type check Patrick McHardy
2004-05-28 10:55 ` Patrick McHardy
2004-05-29 19:38   ` David S. Miller
2004-05-30 23:41     ` Patrick McHardy
2004-05-30 23:59       ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).