Skip to contentSkip to conversation

Fix CIFS compilation with CONFIG_KEYS unset

PATCH New Rafael J. Wysocki 4 participants 11 messages Oct 12, 2008

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

PATCH 1/1 Fix CIFS compilation with CONFIG_KEYS unset

From: Rafael J. Wysocki <[email protected]>

Fix CIFS compilation with CONFIG_KEYS unset

If CONFIG_KEYS is unset, fs/cifs/sess.c doesn't build due to key_revoke() being undefined. Fix that.

---
 include/linux/key.h |    1 +
 1 file changed, 1 insertion(+)
include/linux/key.h +1 -0
Index: linux-2.6/include/linux/key.h
===================================================================
@@ -300,6 +300,7 @@ extern void key_init(void);
 #define key_serial(k)			0
 #define key_get(k) 			({ NULL; })
 #define key_put(k)			do { } while(0)
+#define key_revoke(k)			do { } while(0)
 #define key_ref_put(k)			do { } while(0)
 #define make_key_ref(k, p)			({ NULL; })
 #define key_ref_to_ptr(k)		({ NULL; })
#1 lore raw

PATCH 1/1 Fix CIFS compilation with CONFIG_KEYS unset

Rafael and Guo-Fu,
The following change to address the compile error that you noted is slightly different than what you suggested but should fix what you found.

fs/cifs/sess.c +0 -0
index 2851d5d..d8fce19 100644
@@ -624,10 +624,12 @@ CIFS_SessSetup(unsigned int xid, struct

cifsSesInfo *ses, int first_time,
ses, nls_cp);

ssetup_exit:
+#ifdef CONFIG_CIFS_UPCALL
if (spnego_key) {
key_revoke(spnego_key);
key_put(spnego_key);
}
+#endif
kfree(str_area);
if (resp_buf_type == CIFS_SMALL_BUFFER) {
cFYI(1, ("ssetup freeing small buf %p", iov[0].iov_base));

---------- Forwarded message ----------
From: Rafael J. Wysocki <[email protected]>
Date: Sun, Oct 12, 2008 at 6:15 AM
Subject: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset
To: Linus Torvalds <[email protected]>
Cc: Andrew Morton <[email protected]>, LKML <[email protected]>, Herbert Xu <[email protected]>, Steve French <[email protected]>

From: Rafael J. Wysocki <[email protected]>

Fix CIFS compilation with CONFIG_KEYS unset

If CONFIG_KEYS is unset, fs/cifs/sess.c doesn't build due to key_revoke() being undefined. Fix that.

---
 include/linux/key.h |    1 +
 1 file changed, 1 insertion(+)
include/linux/key.h +1 -0
Index: linux-2.6/include/linux/key.h
===================================================================
@@ -300,6 +300,7 @@ extern void key_init(void);
 #define key_serial(k)                  0
 #define key_get(k)                     ({ NULL; })
 #define key_put(k)                     do { } while(0)
+#define key_revoke(k)                  do { } while(0)
 #define key_ref_put(k)                 do { } while(0)
 #define make_key_ref(k, p)                     ({ NULL; })
 #define key_ref_to_ptr(k)              ({ NULL; })
Signature · 3 lines
Thanks,

Steve
#2 lore raw

On Sun, 12 Oct 2008 08:40:39 -0500, Steve French wrote

Quoted 4 lines

Rafael and Guo-Fu,
The following change to address the compile error that you noted is slightly different than what you suggested but should fix what you found.

Thank you for the fix. :)

Guo-Fu Tseng

#3 lore raw
In reply to Steve French
Quoted 5 lines · On Sun, 12 Oct 2008 08:40:39 -0500 "Steve French" <[email protected]> wrote:

Rafael and Guo-Fu,
The following change to address the compile error that you noted is slightly different than what you suggested but should fix what you found.

Actually, I like Adrian/Rafael's fix better. I think we should avoid cluttering up the code with #ifdef's where possible. key_put() already is a no-op when CONFIG_KEYS is disabled. We might as well do the same thing with key_revoke().

Cheers,

Signature · 1 line
Jeff Layton <[email protected]>
#4 lore raw

On Sun, 12 Oct 2008 09:59:03 -0400, Jeff Layton wrote

Quoted 9 lines
Quoted 5 lines · On Sun, 12 Oct 2008 08:40:39 -0500 "Steve French" <[email protected]> wrote:

Rafael and Guo-Fu,
The following change to address the compile error that you noted is slightly different than what you suggested but should fix what you found.

Quoted 4 lines

Actually, I like Adrian/Rafael's fix better. I think we should avoid cluttering up the code with #ifdef's where possible. key_put() already is a no-op when CONFIG_KEYS is disabled. We might as well do the same thing with key_revoke().

I found that my patch was not reasonable at all.
And I agree with Jeff.

Guo-Fu Tseng

#5 lore raw
In reply to Jeff Layton
Quoted 9 lines · Jeff Layton
Quoted 5 lines · On Sun, 12 Oct 2008 08:40:39 -0500 "Steve French" <[email protected]> wrote:

Rafael and Guo-Fu,
The following change to address the compile error that you noted is slightly different than what you suggested but should fix what you found.

Quoted 4 lines

Actually, I like Adrian/Rafael's fix better. I think we should avoid cluttering up the code with #ifdef's where possible. key_put() already is a no-op when CONFIG_KEYS is disabled. We might as well do the same thing with key_revoke().

I don't think it matters much - but we probably shouldn't be overriding global functions.

Signature · 3 lines
Thanks,

Steve
#6 lore raw
Quoted 10 lines · Steve French
Quoted 7 lines · Jeff Layton

On Sun, 12 Oct 2008 08:40:39 -0500
"Steve French" <[email protected]> wrote:

Actually, I like Adrian/Rafael's fix better. I think we should avoid cluttering up the code with #ifdef's where possible. key_put() already is a no-op when CONFIG_KEYS is disabled. We might as well do the same thing with key_revoke().

I don't think it matters much - but we probably shouldn't be overriding global functions.

To clarify, I like fixing it in keys.h better than overriding it in cifs, but in the meantime we need an ifdef in cifs until keys.h changes.

Signature · 3 lines
Thanks,

Steve
#7 lore raw
Quoted 9 lines · Steve French
Quoted 8 lines · Steve French
Quoted 7 lines · Jeff Layton

On Sun, 12 Oct 2008 08:40:39 -0500
"Steve French" <[email protected]> wrote:

Actually, I like Adrian/Rafael's fix better. I think we should avoid cluttering up the code with #ifdef's where possible. key_put() already is a no-op when CONFIG_KEYS is disabled. We might as well do the same thing with key_revoke().

Quoted 6 lines
Quoted 2 lines

I don't think it matters much - but we probably shouldn't be overriding global functions.

To clarify, I like fixing it in keys.h better than overriding it in cifs, but in the meantime we need an ifdef in cifs until keys.h changes.

Well, adding an empty definition for key_revoke() in the !CONFIG_KEYS case makes sense anyway IMO.

#8 lore raw
Quoted 13 lines · Rafael J. Wysocki
Quoted 12 lines · Steve French
Quoted 10 lines · Steve French
Quoted 7 lines · Jeff Layton

On Sun, 12 Oct 2008 08:40:39 -0500
"Steve French" <[email protected]> wrote:

Actually, I like Adrian/Rafael's fix better. I think we should avoid cluttering up the code with #ifdef's where possible. key_put() already is a no-op when CONFIG_KEYS is disabled. We might as well do the same thing with key_revoke().

I don't think it matters much - but we probably shouldn't be overriding global functions.

Quoted 6 lines
Quoted 3 lines

To clarify, I like fixing it in keys.h better than overriding it in cifs, but in the meantime we need an ifdef in cifs until keys.h changes.

Well, adding an empty definition for key_revoke() in the !CONFIG_KEYS case makes sense anyway IMO.

I agree. ACKED

Signature · 3 lines
Thanks,

Steve
#9 lore raw
In reply to Steve French
Quoted 9 lines · On Sun, 12 Oct 2008 11:57:47 -0500 "Steve French" <[email protected]> wrote:
Quoted 8 lines · Steve French
Quoted 7 lines · Jeff Layton

On Sun, 12 Oct 2008 08:40:39 -0500
"Steve French" <[email protected]> wrote:

Actually, I like Adrian/Rafael's fix better. I think we should avoid cluttering up the code with #ifdef's where possible. key_put() already is a no-op when CONFIG_KEYS is disabled. We might as well do the same thing with key_revoke().

Quoted 9 lines
Quoted 2 lines

I don't think it matters much - but we probably shouldn't be overriding global functions.

To clarify, I like fixing it in keys.h better than overriding it in cifs, but in the meantime we need an ifdef in cifs until keys.h changes.

It's your call, but if we're going to carry a temporary patch, then I'd prefer to just carry the one that adds the empty key_revoke definition. I don't think there's much benefit to changing the cifs code for this, but I don't feel very strongly about it either way...

Signature · 1 line
Jeff Layton <[email protected]>
#10 lore raw
Quoted 6 lines · Jeff Layton

It's your call, but if we're going to carry a temporary patch, then I'd prefer to just carry the one that adds the empty key_revoke definition. I don't think there's much benefit to changing the cifs code for this, but I don't feel very strongly about it either way...
--
Jeff Layton <[email protected]>

There are probably various CIFS_UPCALL related ifdefs that could be merged/shrunk - let's do this as a set later.

Signature · 3 lines
Thanks,

Steve