Skip to contentSkip to conversation

auth_domain_lookup in 2.6.8-rc2

PATCH In review Olaf Kirch 2 participants 2 messages Oct 8, 2004

Subsystems (3)
lore
Share & tools
lore

Olaf Kirch

author
#0 lore raw

PATCH 1/1 auth_domain_lookup in 2.6.8-rc2

Hi,

2.6.8-rc2 open-codes auth_domain_lookup, and introduces a flaw that may have security consequences. If we do not find any matching domain, the routine always returns the last item looked at, no matter what it was.

Olaf

Signature · 3 lines
Olaf Kirch     | Things that make Monday morning interesting, #1:
[email protected]   |        "I want to use NFS over AX25, can you help me?"
---------------+ 

This patch makes sure that auth_domain_lookup returns NULL when it doesn't find a matching entry, rather than the last entry in the hash chain.

net/sunrpc/svcauth.c +3 -1
Index: linux-2.6.8/net/sunrpc/svcauth.c
===================================================================
@@ -183,7 +183,7 @@ auth_domain_lookup(struct auth_domain *i
 	}
 	/* Didn't find anything */
 	if (!set)
-		goto out_noset;
+		goto out_nada;
 	auth_domain_cache.entries++;
 out_set:
 	set_bit(CACHE_HASHED, &item->h.flags);
@@ -193,6 +193,8 @@ out_set:
 	cache_fresh(&auth_domain_cache, &item->h, item->h.expiry_time);
 	cache_get(&item->h);
 	return item;
+out_nada:
+	tmp = NULL;
 out_noset:
 	read_unlock(&auth_domain_cache.hash_lock);
 	return tmp;
#1 lore raw
Quoted 4 lines · Olaf Kirch

2.6.8-rc2 open-codes auth_domain_lookup, and introduces a flaw that may have security consequences. If we do not find any matching domain, the routine always returns the last item looked at, no matter what it was.

Argh, sorry, that was my fault. Thanks for spotting it.--b.

Quoted 20 lines

This patch makes sure that auth_domain_lookup returns NULL when it doesn't find a matching entry, rather than the last entry in the hash chain.

Index: linux-2.6.8/net/sunrpc/svcauth.c
===================================================================

net/sunrpc/svcauth.c +1 -1
@@ -183,7 +183,7 @@ auth_domain_lookup(struct auth_domain *i
 	}
 	/* Didn't find anything */
 	if (!set)
-		goto out_noset;
+		goto out_nada;
 	auth_domain_cache.entries++;
 out_set:
 	set_bit(CACHE_HASHED, &item->h.flags);

net/sunrpc/svcauth.c out_set: · line 200

Quoted 8 lines
net/sunrpc/svcauth.c +2 -0
@@ -193,6 +193,8 @@ out_set:
 	cache_fresh(&auth_domain_cache, &item->h, item->h.expiry_time);
 	cache_get(&item->h);
 	return item;
+out_nada:
+	tmp = NULL;
 out_noset:
 	read_unlock(&auth_domain_cache.hash_lock);
 	return tmp;

-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs