Skip to contentSkip to conversation

KEYS: testing wrong bit for KEY_FLAG_REVOKED

PATCH New Dan Carpenter 1 participant 1 message Mar 6, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 KEYS: testing wrong bit for KEY_FLAG_REVOKED

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.

---
v2: the first patch introduced a new variable to avoid breaking the 80
char limit.

security/keys/process_keys.c +2 -1
index 1068cb1..eaeb0bd 100644
@@ -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 {