Patchwork Fix CIFS compilation with CONFIG_KEYS unset

login
register
mail settings
Submitter Steve French
Date Oct. 12, 2008, 1:40 p.m.
Message ID <524f69650810120640v41778375wf0a7662e773da26f@mail.gmail.com>
Download mbox | patch
Permalink /patch/4086/
State Not Applicable
Headers show

Comments

Steve French - Oct. 12, 2008, 1:40 p.m.
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.
Guo-Fu Tseng - Oct. 12, 2008, 1:42 p.m.
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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Layton - Oct. 12, 2008, 1:59 p.m.
On Sun, 12 Oct 2008 08:40:39 -0500
"Steve French" <smfrench@gmail.com> 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,
Guo-Fu Tseng - Oct. 12, 2008, 2:12 p.m.
On Sun, 12 Oct 2008 09:59:03 -0400, Jeff Layton wrote
> On Sun, 12 Oct 2008 08:40:39 -0500
> "Steve French" <smfrench@gmail.com> 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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve French - Oct. 12, 2008, 4:53 p.m.
On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <jlayton@redhat.com> wrote:
> On Sun, 12 Oct 2008 08:40:39 -0500
> "Steve French" <smfrench@gmail.com> 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.
Steve French - Oct. 12, 2008, 4:57 p.m.
On Sun, Oct 12, 2008 at 11:53 AM, Steve French <smfrench@gmail.com> wrote:
> On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <jlayton@redhat.com> wrote:
>> On Sun, 12 Oct 2008 08:40:39 -0500
>> "Steve French" <smfrench@gmail.com> 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.
Rafael J. Wysocki - Oct. 12, 2008, 5:09 p.m.
On Sunday, 12 of October 2008, Steve French wrote:
> On Sun, Oct 12, 2008 at 11:53 AM, Steve French <smfrench@gmail.com> wrote:
> > On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <jlayton@redhat.com> wrote:
> >> On Sun, 12 Oct 2008 08:40:39 -0500
> >> "Steve French" <smfrench@gmail.com> 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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve French - Oct. 12, 2008, 6:47 p.m.
On Sun, Oct 12, 2008 at 12:09 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Sunday, 12 of October 2008, Steve French wrote:
>> On Sun, Oct 12, 2008 at 11:53 AM, Steve French <smfrench@gmail.com> wrote:
>> > On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <jlayton@redhat.com> wrote:
>> >> On Sun, 12 Oct 2008 08:40:39 -0500
>> >> "Steve French" <smfrench@gmail.com> 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
Jeff Layton - Oct. 12, 2008, 8:16 p.m.
On Sun, 12 Oct 2008 11:57:47 -0500
"Steve French" <smfrench@gmail.com> wrote:

> On Sun, Oct 12, 2008 at 11:53 AM, Steve French <smfrench@gmail.com> wrote:
> > On Sun, Oct 12, 2008 at 8:59 AM, Jeff Layton <jlayton@redhat.com> wrote:
> >> On Sun, 12 Oct 2008 08:40:39 -0500
> >> "Steve French" <smfrench@gmail.com> 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...
Steve French - Oct. 12, 2008, 8:38 p.m.
On Sun, Oct 12, 2008 at 3:16 PM, Jeff Layton <jlayton@redhat.com> 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 <jlayton@redhat.com>

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

Patch

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 <rjw@sisk.pl>
Date: Sun, Oct 12, 2008 at 6:15 AM
Subject: [PATCH] Fix CIFS compilation with CONFIG_KEYS unset
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>, LKML
<linux-kernel@vger.kernel.org>, Herbert Xu
<herbert@gondor.apana.org.au>, Steve French <smfrench@gmail.com>


From: Rafael J. Wysocki <rjw@sisk.pl>

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 <rjw@sisk.pl>
---
 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; })