2008-10-12 11:11:27

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
include/linux/key.h | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6/include/linux/key.h
===================================================================
--- linux-2.6.orig/include/linux/key.h
+++ 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; })


2008-10-12 13:40:54

by Steve French

[permalink] [raw]
Subject: Fwd: [PATCH] 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.

diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 2851d5d..d8fce19 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -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.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
include/linux/key.h | 1 +
1 file changed, 1 insertion(+)

Index: linux-2.6/include/linux/key.h
===================================================================
--- linux-2.6.orig/include/linux/key.h
+++ 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; })



--
Thanks,

Steve

2008-10-12 13:53:15

by Guo-Fu Tseng

[permalink] [raw]
Subject: Re: Fwd: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset

On Sun, 12 Oct 2008 08:40:39 -0500, Steve French 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.
Thank you for the fix. :)

Guo-Fu Tseng

2008-10-12 13:59:45

by Jeff Layton

[permalink] [raw]
Subject: Re: [linux-cifs-client] Fwd: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset

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,
--
Jeff Layton <[email protected]>

2008-10-12 14:13:22

by Guo-Fu Tseng

[permalink] [raw]
Subject: Re: [linux-cifs-client] Fwd: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset

On Sun, 12 Oct 2008 09:59:03 -0400, Jeff Layton wrote
> 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().
I found that my patch was not reasonable at all.
And I agree with Jeff.

Guo-Fu Tseng

2008-10-12 16:53:33

by Steve French

[permalink] [raw]
Subject: Re: [linux-cifs-client] Fwd: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset

On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <[email protected]> wrote:
> 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().
I don't think it matters much - but we probably shouldn't be
overriding global functions.

--
Thanks,

Steve

2008-10-12 16:58:01

by Steve French

[permalink] [raw]
Subject: Re: [linux-cifs-client] Fwd: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset

On Sun, Oct 12, 2008 at 11:53 AM, Steve French <[email protected]> wrote:
> On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <[email protected]> wrote:
>> 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.



--
Thanks,

Steve

2008-10-12 17:05:55

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [linux-cifs-client] Fwd: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset

On Sunday, 12 of October 2008, Steve French wrote:
> On Sun, Oct 12, 2008 at 11:53 AM, Steve French <[email protected]> wrote:
> > On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <[email protected]> wrote:
> >> 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.

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

2008-10-12 18:47:27

by Steve French

[permalink] [raw]
Subject: Re: [linux-cifs-client] Fwd: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset

On Sun, Oct 12, 2008 at 12:09 PM, Rafael J. Wysocki <[email protected]> wrote:
> On Sunday, 12 of October 2008, Steve French wrote:
>> On Sun, Oct 12, 2008 at 11:53 AM, Steve French <[email protected]> wrote:
>> > On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <[email protected]> wrote:
>> >> 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.
>
> Well, adding an empty definition for key_revoke() in the !CONFIG_KEYS case
> makes sense anyway IMO.

I agree. ACKED

--
Thanks,

Steve

2008-10-12 20:17:28

by Jeff Layton

[permalink] [raw]
Subject: Re: [linux-cifs-client] Fwd: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset

On Sun, 12 Oct 2008 11:57:47 -0500
"Steve French" <[email protected]> wrote:

> On Sun, Oct 12, 2008 at 11:53 AM, Steve French <[email protected]> wrote:
> > On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <[email protected]> wrote:
> >> 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.
>
>
>

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]>

2008-10-12 20:39:00

by Steve French

[permalink] [raw]
Subject: Re: [linux-cifs-client] Fwd: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset

On Sun, Oct 12, 2008 at 3:16 PM, Jeff Layton <[email protected]> wrote:
> 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.


--
Thanks,

Steve