public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch v2] KEYS: testing wrong bit for KEY_FLAG_REVOKED
@ 2012-03-06 12:36 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2012-03-06 12:36 UTC (permalink / raw)
  To: kernel-janitors

The test for "if (cred->request_key_auth->flags & KEY_FLAG_REVOKED) {"
should actually testing that the (1 << KEY_FLAG_REVOKED) bit is set.
The current code actually checks for KEY_FLAG_DEAD.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: the first patch introduced a new variable to avoid breaking the 80
    char limit.

diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 1068cb1..eaeb0bd 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -657,7 +657,8 @@ try_again:
 			goto error;
 
 		down_read(&cred->request_key_auth->sem);
-		if (cred->request_key_auth->flags & KEY_FLAG_REVOKED) {
+		if (test_bit(KEY_FLAG_REVOKED,
+					&cred->request_key_auth->flags)) {
 			key_ref = ERR_PTR(-EKEYREVOKED);
 			key = NULL;
 		} else {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-06 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-06 12:36 [patch v2] KEYS: testing wrong bit for KEY_FLAG_REVOKED Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox