Skip to contentSkip to conversation

Keys: Fix key quota management on key allocation

PATCH New David Howells 1 participant 1 message Feb 17, 2006

Subsystems (2)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 Keys: Fix key quota management on key allocation

The attached patch makes key quota detection generate an error if either quota is exceeded rather than only if both quotas are exceeded.

---
warthog>diffstat -p1 keys-quota-2616rc3.diff

 security/keys/key.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
security/keys/key.c +2 -2
diff -uNrp linux-2.6.16-rc3/security/keys/key.c linux-2.6.16-rc3-key-quota/security/keys/key.c
@@ -1,6 +1,6 @@
 /* key.c: basic authentication token and access key management
  *
- * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
+ * Copyright (C) 2004-6 Red Hat, Inc. All Rights Reserved.
  * Written by David Howells ([email protected])
  *
  * This program is free software; you can redistribute it and/or
@@ -271,7 +271,7 @@ struct key *key_alloc(struct key_type *t
 	 * its description */
 	if (!not_in_quota) {
 		spin_lock(&user->lock);
-		if (user->qnkeys + 1 >= KEYQUOTA_MAX_KEYS &&
+		if (user->qnkeys + 1 >= KEYQUOTA_MAX_KEYS ||
 		    user->qnbytes + quotalen >= KEYQUOTA_MAX_BYTES
 		    )
 			goto no_quota;