All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, steve <sanpatr1@in.ibm.com>,
	Shirish Pargaonkar <shirishpargaonkar@gmail.com>,
	Jeff Layton <jlayton@redhat.com>,
	Steve French <smfrench@gmail.com>
Subject: [ 24/24] Handle big endianness in NTLM (ntlmv2) authentication
Date: Thu, 18 Jul 2013 19:24:56 -0700	[thread overview]
Message-ID: <20130719022405.671266396@linuxfoundation.org> (raw)
In-Reply-To: <20130719022404.015008451@linuxfoundation.org>

3.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Steve French <smfrench@us.ibm.com>

commit fdf96a907c1fbb93c633e2b7ede3b8df26d6a4c0 upstream.

This is RH bug 970891
Uppercasing of username during calculation of ntlmv2 hash fails
because UniStrupr function does not handle big endian wchars.

Also fix a comment in the same code to reflect its correct usage.

[To make it easier for stable (rather than require 2nd patch) fixed
this patch of Shirish's to remove endian warning generated
by sparse -- steve f.]

Reported-by: steve <sanpatr1@in.ibm.com>
Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/cifs/cifs_unicode.h |    8 ++++----
 fs/cifs/cifsencrypt.c  |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

--- a/fs/cifs/cifs_unicode.h
+++ b/fs/cifs/cifs_unicode.h
@@ -323,14 +323,14 @@ UniToupper(register wchar_t uc)
 /*
  * UniStrupr:  Upper case a unicode string
  */
-static inline wchar_t *
-UniStrupr(register wchar_t *upin)
+static inline __le16 *
+UniStrupr(register __le16 *upin)
 {
-	register wchar_t *up;
+	register __le16 *up;
 
 	up = upin;
 	while (*up) {		/* For all characters */
-		*up = UniToupper(*up);
+		*up = cpu_to_le16(UniToupper(le16_to_cpu(*up)));
 		up++;
 	}
 	return upin;		/* Return input pointer */
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -394,7 +394,7 @@ static int calc_ntlmv2_hash(struct cifs_
 	int rc = 0;
 	int len;
 	char nt_hash[CIFS_NTHASH_SIZE];
-	wchar_t *user;
+	__le16 *user;
 	wchar_t *domain;
 	wchar_t *server;
 
@@ -419,7 +419,7 @@ static int calc_ntlmv2_hash(struct cifs_
 		return rc;
 	}
 
-	/* convert ses->user_name to unicode and uppercase */
+	/* convert ses->user_name to unicode */
 	len = ses->user_name ? strlen(ses->user_name) : 0;
 	user = kmalloc(2 + (len * 2), GFP_KERNEL);
 	if (user == NULL) {
@@ -429,7 +429,7 @@ static int calc_ntlmv2_hash(struct cifs_
 	}
 
 	if (len) {
-		len = cifs_strtoUTF16((__le16 *)user, ses->user_name, len, nls_cp);
+		len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp);
 		UniStrupr(user);
 	} else {
 		memset(user, '\0', 2);



  parent reply	other threads:[~2013-07-19  2:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19  2:24 [ 00/24] 3.4.54-stable review Greg Kroah-Hartman
2013-07-19  2:24 ` [ 01/24] CIFS use sensible file nlink values if unprovided Greg Kroah-Hartman
2013-07-19  2:24 ` [ 02/24] rtlwifi: rtl8192cu: Add new USB ID for TP-Link TL-WN8200ND Greg Kroah-Hartman
2013-07-19  2:24 ` [ 03/24] rtlwifi: rtl8192cu: Fix duplicate if test Greg Kroah-Hartman
2013-07-19  2:24 ` [ 04/24] jbd2: fix theoretical race in jbd2__journal_restart Greg Kroah-Hartman
2013-07-19  2:24 ` [ 05/24] ext3,ext4: dont mess with dir_file->f_pos in htree_dirblock_to_tree() Greg Kroah-Hartman
2013-07-19  2:24 ` [ 06/24] USB: option,qcserial: move Novatel Gobi1K IDs to qcserial Greg Kroah-Hartman
2013-07-19  2:24 ` [ 07/24] usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed Greg Kroah-Hartman
2013-07-19  2:24 ` [ 08/24] xhci: check for failed dma pool allocation Greg Kroah-Hartman
2013-07-19  2:24 ` [ 09/24] usb: host: xhci-plat: release mem region while removing module Greg Kroah-Hartman
2013-07-19  2:24 ` [ 10/24] pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status Greg Kroah-Hartman
2013-07-19  2:24 ` [ 11/24] xen/time: remove blocked time accounting from xen "clockchip" Greg Kroah-Hartman
2013-07-19  2:24 ` [ 12/24] genirq: Fix can_request_irq() for IRQs without an action Greg Kroah-Hartman
2013-07-19  2:24 ` [ 13/24] drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq Greg Kroah-Hartman
2013-07-19  2:24 ` [ 14/24] ACPI / EC: Add HP Folio 13 to ec_dmi_table in order to skip DSDT scan Greg Kroah-Hartman
2013-07-19  2:24 ` [ 15/24] ocfs2: xattr: fix inlined xattr reflink Greg Kroah-Hartman
2013-07-19  2:24 ` [ 16/24] ahci: Add AMD CZ SATA device ID Greg Kroah-Hartman
2013-07-19  2:24 ` [ 17/24] ahci: remove pmp link online check in FBS EH Greg Kroah-Hartman
2013-07-19  2:24 ` [ 18/24] timer: Fix jiffies wrap behavior of round_jiffies_common() Greg Kroah-Hartman
2013-07-19  2:24 ` [ 19/24] ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs Greg Kroah-Hartman
2013-07-19  2:24 ` [ 20/24] ext4: fix overflow when counting used blocks on 32-bit architectures Greg Kroah-Hartman
2013-07-19  2:24 ` [ 21/24] ext4: dont allow ext4_free_blocks() to fail due to ENOMEM Greg Kroah-Hartman
2013-07-19  2:24 ` [ 22/24] ARM: 7765/1: perf: Record the user-mode PC in the call chain Greg Kroah-Hartman
2013-07-19  2:24 ` [ 23/24] drivers/dma/pl330.c: fix locking in pl330_free_chan_resources() Greg Kroah-Hartman
2013-07-19  2:24 ` Greg Kroah-Hartman [this message]
2013-07-19 23:19 ` [ 00/24] 3.4.54-stable review Shuah Khan
2013-07-19 23:19   ` Shuah Khan
2013-07-21  0:37 ` Satoru Takeuchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130719022405.671266396@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=jlayton@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sanpatr1@in.ibm.com \
    --cc=shirishpargaonkar@gmail.com \
    --cc=smfrench@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.