From: David Howells Date: Sat, 25 Mar 2006 11:06:51 +0000 (-0800) Subject: [PATCH] Keys: Fix key quota management on key allocation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3dccff8dc00994428777f483922058c554db85bd;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git [PATCH] Keys: Fix key quota management on key allocation Make key quota detection generate an error if either quota is exceeded rather than only if both quotas are exceeded. Signed-off-by: David Howells Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/security/keys/key.c b/security/keys/key.c index 99781b798312..627697181e6a 100644 --- a/security/keys/key.c +++ b/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 (dhowells@redhat.com) * * This program is free software; you can redistribute it and/or @@ -271,7 +271,7 @@ struct key *key_alloc(struct key_type *type, const char *desc, * 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;