Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3dccff8d authored by David Howells's avatar David Howells Committed by Linus Torvalds
Browse files

[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: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a7d06ca7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* 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;