]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
.38 patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 19 May 2011 17:01:34 +0000 (10:01 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 19 May 2011 17:01:34 +0000 (10:01 -0700)
queue-2.6.38/cifs-clean-up-various-nits-in-unicode-routines-try-2.patch [new file with mode: 0644]
queue-2.6.38/cifs-fix-cifsconverttoucs-for-the-mapchars-case.patch [new file with mode: 0644]
queue-2.6.38/iwlegacy-fix-ibss-mode-crashes.patch [new file with mode: 0644]
queue-2.6.38/series

diff --git a/queue-2.6.38/cifs-clean-up-various-nits-in-unicode-routines-try-2.patch b/queue-2.6.38/cifs-clean-up-various-nits-in-unicode-routines-try-2.patch
new file mode 100644 (file)
index 0000000..9cc47d9
--- /dev/null
@@ -0,0 +1,140 @@
+From 581ade4d1c025eb10421eda0d0c0a2f04447d7c5 Mon Sep 17 00:00:00 2001
+From: Jeff Layton <jlayton@redhat.com>
+Date: Tue, 5 Apr 2011 15:02:37 -0400
+Subject: cifs: clean up various nits in unicode routines (try #2)
+
+From: Jeff Layton <jlayton@redhat.com>
+
+commit 581ade4d1c025eb10421eda0d0c0a2f04447d7c5 upstream.
+
+Minor revision to the original patch. Don't abuse the __le16 variable
+on the stack by casting it to wchar_t and handing it off to char2uni.
+Declare an actual wchar_t on the stack instead. This fixes a valid
+sparse warning.
+
+Fix the spelling of UNI_ASTERISK. Eliminate the unneeded len_remaining
+variable in cifsConvertToUCS.
+
+Also, as David Howells points out. We were better off making
+cifsConvertToUCS *not* use put_unaligned_le16 since it means that we
+can't optimize the mapped characters at compile time. Switch them
+instead to use cpu_to_le16, and simply use put_unaligned to set them
+in the string.
+
+Reported-and-acked-by: David Howells <dhowells@redhat.com>
+Signed-off-by: Jeff Layton <jlayton@redhat.com>
+Signed-off-by: Steve French <sfrench@us.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/cifs/cifs_unicode.c |   35 +++++++++++++++++------------------
+ fs/cifs/cifs_unicode.h |    2 +-
+ 2 files changed, 18 insertions(+), 19 deletions(-)
+
+--- a/fs/cifs/cifs_unicode.c
++++ b/fs/cifs/cifs_unicode.c
+@@ -90,7 +90,7 @@ cifs_mapchar(char *target, const __u16 s
+       case UNI_COLON:
+               *target = ':';
+               break;
+-      case UNI_ASTERIK:
++      case UNI_ASTERISK:
+               *target = '*';
+               break;
+       case UNI_QUESTION:
+@@ -264,40 +264,40 @@ cifs_strndup_from_ucs(const char *src, c
+  * names are little endian 16 bit Unicode on the wire
+  */
+ int
+-cifsConvertToUCS(__le16 *target, const char *source, int maxlen,
++cifsConvertToUCS(__le16 *target, const char *source, int srclen,
+                const struct nls_table *cp, int mapChars)
+ {
+       int i, j, charlen;
+-      int len_remaining = maxlen;
+       char src_char;
+-      __u16 temp;
++      __le16 dst_char;
++      wchar_t tmp;
+       if (!mapChars)
+               return cifs_strtoUCS(target, source, PATH_MAX, cp);
+-      for (i = 0, j = 0; i < maxlen; j++) {
++      for (i = 0, j = 0; i < srclen; j++) {
+               src_char = source[i];
+               switch (src_char) {
+               case 0:
+-                      put_unaligned_le16(0, &target[j]);
++                      put_unaligned(0, &target[j]);
+                       goto ctoUCS_out;
+               case ':':
+-                      temp = UNI_COLON;
++                      dst_char = cpu_to_le16(UNI_COLON);
+                       break;
+               case '*':
+-                      temp = UNI_ASTERIK;
++                      dst_char = cpu_to_le16(UNI_ASTERISK);
+                       break;
+               case '?':
+-                      temp = UNI_QUESTION;
++                      dst_char = cpu_to_le16(UNI_QUESTION);
+                       break;
+               case '<':
+-                      temp = UNI_LESSTHAN;
++                      dst_char = cpu_to_le16(UNI_LESSTHAN);
+                       break;
+               case '>':
+-                      temp = UNI_GRTRTHAN;
++                      dst_char = cpu_to_le16(UNI_GRTRTHAN);
+                       break;
+               case '|':
+-                      temp = UNI_PIPE;
++                      dst_char = cpu_to_le16(UNI_PIPE);
+                       break;
+               /*
+                * FIXME: We can not handle remapping backslash (UNI_SLASH)
+@@ -305,17 +305,17 @@ cifsConvertToUCS(__le16 *target, const c
+                * as they use backslash as separator.
+                */
+               default:
+-                      charlen = cp->char2uni(source+i, len_remaining,
+-                                              &temp);
++                      charlen = cp->char2uni(source + i, srclen - i, &tmp);
++                      dst_char = cpu_to_le16(tmp);
++
+                       /*
+                        * if no match, use question mark, which at least in
+                        * some cases serves as wild card
+                        */
+                       if (charlen < 1) {
+-                              temp = 0x003f;
++                              dst_char = cpu_to_le16(0x003f);
+                               charlen = 1;
+                       }
+-                      len_remaining -= charlen;
+                       /*
+                        * character may take more than one byte in the source
+                        * string, but will take exactly two bytes in the
+@@ -324,9 +324,8 @@ cifsConvertToUCS(__le16 *target, const c
+                       i += charlen;
+                       continue;
+               }
+-              put_unaligned_le16(temp, &target[j]);
++              put_unaligned(dst_char, &target[j]);
+               i++; /* move to next char in source string */
+-              len_remaining--;
+       }
+ ctoUCS_out:
+--- a/fs/cifs/cifs_unicode.h
++++ b/fs/cifs/cifs_unicode.h
+@@ -44,7 +44,7 @@
+  * reserved symbols (along with \ and /), otherwise illegal to store
+  * in filenames in NTFS
+  */
+-#define UNI_ASTERIK     (__u16) ('*' + 0xF000)
++#define UNI_ASTERISK    (__u16) ('*' + 0xF000)
+ #define UNI_QUESTION    (__u16) ('?' + 0xF000)
+ #define UNI_COLON       (__u16) (':' + 0xF000)
+ #define UNI_GRTRTHAN    (__u16) ('>' + 0xF000)
diff --git a/queue-2.6.38/cifs-fix-cifsconverttoucs-for-the-mapchars-case.patch b/queue-2.6.38/cifs-fix-cifsconverttoucs-for-the-mapchars-case.patch
new file mode 100644 (file)
index 0000000..12f0f43
--- /dev/null
@@ -0,0 +1,65 @@
+From 11379b5e33950048ad66825da7f462b0d0da9d73 Mon Sep 17 00:00:00 2001
+From: Jeff Layton <jlayton@redhat.com>
+Date: Tue, 17 May 2011 15:28:21 -0400
+Subject: cifs: fix cifsConvertToUCS() for the mapchars case
+
+From: Jeff Layton <jlayton@redhat.com>
+
+commit 11379b5e33950048ad66825da7f462b0d0da9d73 upstream.
+
+As Metze pointed out, commit 84cdf74e broke mapchars option:
+
+    Commit "cifs: fix unaligned accesses in cifsConvertToUCS"
+    (84cdf74e8096a10dd6acbb870dd404b92f07a756) does multiple steps
+    in just one commit (moving the function and changing it without
+    testing).
+
+    put_unaligned_le16(temp, &target[j]); is never called for any
+    codepoint the goes via the 'default' switch statement. As a result
+    we put just zero (or maybe uninitialized) bytes into the target
+    buffer.
+
+His proposed patch looks correct, but doesn't apply to the current head
+of the tree. This patch should also fix it.
+
+Reported-by: Stefan Metzmacher <metze@samba.org>
+Signed-off-by: Jeff Layton <jlayton@redhat.com>
+Signed-off-by: Steve French <sfrench@us.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/cifs/cifs_unicode.c |   14 ++++++--------
+ 1 file changed, 6 insertions(+), 8 deletions(-)
+
+--- a/fs/cifs/cifs_unicode.c
++++ b/fs/cifs/cifs_unicode.c
+@@ -277,6 +277,7 @@ cifsConvertToUCS(__le16 *target, const c
+       for (i = 0, j = 0; i < srclen; j++) {
+               src_char = source[i];
++              charlen = 1;
+               switch (src_char) {
+               case 0:
+                       put_unaligned(0, &target[j]);
+@@ -316,16 +317,13 @@ cifsConvertToUCS(__le16 *target, const c
+                               dst_char = cpu_to_le16(0x003f);
+                               charlen = 1;
+                       }
+-                      /*
+-                       * character may take more than one byte in the source
+-                       * string, but will take exactly two bytes in the
+-                       * target string
+-                       */
+-                      i += charlen;
+-                      continue;
+               }
++              /*
++               * character may take more than one byte in the source string,
++               * but will take exactly two bytes in the target string
++               */
++              i += charlen;
+               put_unaligned(dst_char, &target[j]);
+-              i++; /* move to next char in source string */
+       }
+ ctoUCS_out:
diff --git a/queue-2.6.38/iwlegacy-fix-ibss-mode-crashes.patch b/queue-2.6.38/iwlegacy-fix-ibss-mode-crashes.patch
new file mode 100644 (file)
index 0000000..294aecf
--- /dev/null
@@ -0,0 +1,63 @@
+From eb85de3f84868ca85703a23617b4079ce79a801e Mon Sep 17 00:00:00 2001
+From: Stanislaw Gruszka <sgruszka@redhat.com>
+Date: Sat, 7 May 2011 17:46:21 +0200
+Subject: iwlegacy: fix IBSS mode crashes
+
+From: Stanislaw Gruszka <sgruszka@redhat.com>
+
+commit eb85de3f84868ca85703a23617b4079ce79a801e upstream.
+
+We should not switch to non-IBSS channels when working in IBSS mode,
+otherwise there are microcode errors, and after some time system
+crashes.
+
+This bug is only observable when software scan is used in IBSS mode,
+so should be considered as regression after:
+
+commit 0263aa45293838b514b8af674a03faf040991a90
+Author: Stanislaw Gruszka <sgruszka@redhat.com>
+Date:   Tue Mar 29 11:24:21 2011 +0200
+
+    iwl3945: disable hw scan by default
+
+However IBSS mode check, which this patch add again, was removed by
+
+commit b2f30e8bdd8ef5f3b5a7ef9146509585a15347d3
+Author: Johannes Berg <johannes.berg@intel.com>
+Date:   Thu Jan 21 07:32:20 2010 -0800
+
+    iwlwifi: remove IBSS channel sanity check
+
+That commit claim that mac80211 will not use non-IBSS channel in IBSS
+mode, what definitely is not true. Bug probably should be fixed in
+mac80211, but that will require more work, so better to apply that patch
+temporally, and provide proper mac80211 fix latter.
+
+Resolves:
+https://bugzilla.kernel.org/show_bug.cgi?id=34452
+
+Reported-and-tested-by: Mikko Rapeli <mikko.rapeli@iki.fi>
+Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/wireless/iwlwifi/iwl-legacy.c |    7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/net/wireless/iwlwifi/iwl-legacy.c
++++ b/drivers/net/wireless/iwlwifi/iwl-legacy.c
+@@ -123,6 +123,13 @@ int iwl_legacy_mac_config(struct ieee802
+                       goto set_ch_out;
+               }
++              if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
++                  !is_channel_ibss(ch_info)) {
++                      IWL_DEBUG_MAC80211(priv, "leave - not IBSS channel\n");
++                      ret = -EINVAL;
++                      goto set_ch_out;
++              }
++
+               spin_lock_irqsave(&priv->lock, flags);
+               for_each_context(priv, ctx) {
index c9dc05d4d2d3d2ff60413dc51418232009727015..e283948adfeb1734fbaabf4610c2ba5af123ada8 100644 (file)
@@ -66,3 +66,6 @@ megaraid_sas-sanity-check-user-supplied-length-before-passing-it-to-dma_alloc_co
 cdrom-always-check_disk_change-on-open.patch
 vmxnet3-fix-inconsistent-lro-state-after-initialization.patch
 revert-retrieve-the-caching-mode-page.patch
+cifs-clean-up-various-nits-in-unicode-routines-try-2.patch
+cifs-fix-cifsconverttoucs-for-the-mapchars-case.patch
+iwlegacy-fix-ibss-mode-crashes.patch