Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

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

Cc: <stable@kernel.org
Reported-and-Tested-by: Chris Clayton <chris2553@googlemail.com>
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Steve French <smfrench@gmail.com>

authored by

Shirish Pargaonkar and committed by
Steve French
de47a417 2a73ca82

+3 -4
+3 -4
fs/cifs/sess.c
··· 246 246 /* copy user */ 247 247 /* BB what about null user mounts - check that we do this BB */ 248 248 /* copy user */ 249 - if (ses->user_name != NULL) 249 + if (ses->user_name != NULL) { 250 250 strncpy(bcc_ptr, ses->user_name, MAX_USERNAME_SIZE); 251 + bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE); 252 + } 251 253 /* else null user mount */ 252 - 253 - bcc_ptr += strnlen(ses->user_name, MAX_USERNAME_SIZE); 254 254 *bcc_ptr = 0; 255 255 bcc_ptr++; /* account for null termination */ 256 256 257 257 /* copy domain */ 258 - 259 258 if (ses->domainName != NULL) { 260 259 strncpy(bcc_ptr, ses->domainName, 256); 261 260 bcc_ptr += strnlen(ses->domainName, 256);