Skip to contentSkip to conversation

cifs: Fix oops in session setup code for null user mounts

PATCH Steve French 1 participant 1 message Feb 2, 2012 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Steve French

author Applied
#2 lore raw
In reply to a message not in the archive

Merged into cifs-2.6.git

Quoted 41 lines · On Thu, Feb 2, 2012 at 3:28 PM, <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@publ…

From: Shirish Pargaonkar <[email protected]>

For null user mounts, do not invoke string length function during session setup.

---
 fs/cifs/sess.c |    7 +++----

 1 files changed, 3 insertions(+), 4 deletions(-)
fs/cifs/sess.c +3 -3
index eb76741..551d0c2 100644
@@ -246,16 +246,15 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
        /* copy user */
        /* BB what about null user mounts - check that we do this BB */
        /* copy user */
-       if (ses->user_name != NULL)
+       if (ses->user_name != NULL) {
                strncpy(bcc_ptr, ses->user_name, MAX_USERNAME_SIZE);
+               bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE);
+       }
        /* else null user mount */
-
-       bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE);
        *bcc_ptr = 0;

       bcc_ptr++; /* account for null termination */

       /* copy domain */
-
       if (ses->domainName != NULL) { strncpy(bcc_ptr, ses->domainName, 256); bcc_ptr += strnlen(ses->domainName, 256); --
1.6.0.2

Signature · 3 lines
Thanks,

Steve