On Wed, 18 May 2011 17:03:42 -0700
<[email protected]> wrote:

> 
> The patch below does not apply to the .38-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <[email protected]>.
> 
> thanks,
> 
> greg k-h
> 

Hi Greg,

It should apply cleanly if the prerequisite patch in the Cc: stable line
is applied first. Did I not do the syntax for that right?



> ------------------ original commit in Linus's tree ------------------
> 
> From 11379b5e33950048ad66825da7f462b0d0da9d73 Mon Sep 17 00:00:00 2001
> From: Jeff Layton <[email protected]>
> Date: Tue, 17 May 2011 15:28:21 -0400
> Subject: [PATCH] cifs: fix cifsConvertToUCS() for the mapchars case
> 
> 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.
> 
> Cc: <[email protected]> # .38.x: 581ade4: cifs: clean up various nits in 
> unicode routines (try #2)
> Reported-by: Stefan Metzmacher <[email protected]>
> Signed-off-by: Jeff Layton <[email protected]>
> Signed-off-by: Steve French <[email protected]>
> 
> diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
> index 23d43cd..1b2e180 100644
> --- a/fs/cifs/cifs_unicode.c
> +++ b/fs/cifs/cifs_unicode.c
> @@ -277,6 +277,7 @@ cifsConvertToUCS(__le16 *target, const char *source, int 
> srclen,
>  
>       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 char *source, 
> int srclen,
>                               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:
> 


-- 
Jeff Layton <[email protected]>

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to