[PATCH] CAN-2005-0750: Fix af_bluetooth range checking bug, discovered by Ilja van Sprundel <[email protected]>

Linux Kernel Mailing List <[email protected]> Fri, 25 Mar 2005 20:15:59 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1480, 2005/03/25 17:15:59-03:00, [email protected]

	[PATCH] CAN-2005-0750: Fix af_bluetooth range checking bug, discovered by Ilja van Sprundel <[email protected]>
	
	Fix range checking



 af_bluetooth.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


diff -Nru a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
--- a/net/bluetooth/af_bluetooth.c	2005-03-25 20:04:15 -08:00
+++ b/net/bluetooth/af_bluetooth.c	2005-03-25 20:04:15 -08:00
@@ -62,7 +62,7 @@
 
 int bluez_sock_register(int proto, struct net_proto_family *ops)
 {
-	if (proto >= BLUEZ_MAX_PROTO)
+	if (proto < 0 || proto >= BLUEZ_MAX_PROTO)
 		return -EINVAL;
 
 	if (bluez_proto[proto])
@@ -74,7 +74,7 @@
 
 int bluez_sock_unregister(int proto)
 {
-	if (proto >= BLUEZ_MAX_PROTO)
+	if (proto < 0 || proto >= BLUEZ_MAX_PROTO)
 		return -EINVAL;
 
 	if (!bluez_proto[proto])
@@ -86,7 +86,7 @@
 
 static int bluez_sock_create(struct socket *sock, int proto)
 {
-	if (proto >= BLUEZ_MAX_PROTO)
+	if (proto < 0 || proto >= BLUEZ_MAX_PROTO)
 		return -EINVAL;
 
 #if defined(CONFIG_KMOD)