Skip to contentSkip to conversation

KEYS: Revert one application of "Fix unreachable code" patch [ver #2]

PATCH In review David Howells 2 participants 2 messages Feb 21, 2013

Subsystems (3)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 KEYS: Revert one application of "Fix unreachable code" patch [ver #2]

A patch to fix some unreachable code in search_my_process_keyrings() got applied twice by two different routes upstream:

	commit e67eab39bee26f509d38d00ca1a8f24b63f46a31
	Author: Alan Cox <[email protected]>
	Date:   Thu Dec 20 15:05:54 2012 -0800
	keys: fix unreachable code

and:

	commit b010520ab3d2c05eb444ed5e01fe6c33842f597a
	Author: Alan Cox <[email protected]>
	Date:   Thu Oct 25 15:23:35 2012 +0100
	keys: Fix unreachable code

Unfortunately, the second application removed something it shouldn't have and this wasn't detected by GIT. This is due to the patch not having sufficient lines of context to distinguish the two places of application.

The effect of this is relatively minor: inside the kernel, the keyring search routines may search multiple keyrings and then prioritise the errors if no keys or negative keys are found in any of them. With the extra deletion, the presence of a negative key in the thread keyring (causing ENOKEY) is incorrectly overridden by an error searching the process keyring.

So revert the second application of the patch.

---

 security/keys/process_keys.c |    2 ++
 1 file changed, 2 insertions(+)
security/keys/process_keys.c +2 -0
index 20e4bf5..58dfe08 100644
@@ -367,6 +367,8 @@ key_ref_t search_my_process_keyrings(struct key_type *type,
 
 		switch (PTR_ERR(key_ref)) {
 		case -EAGAIN: /* no key */
+			if (ret)
+				break;
 		case -ENOKEY: /* negative key */
 			ret = key_ref;
 			break;
#1 lore raw
Quoted 2 lines · David Howells

A patch to fix some unreachable code in search_my_process_keyrings() got applied twice by two different routes upstream:

Ok, applied. Let's not apply this one twice. So Andrew, please don't put it in your queue ;)

Linus