Patch "ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     alsa-seq-fix-function-prototype-mismatch-in-snd_seq_.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 304c4181a9dc3f4e1bb499fe37bd24af23caf078
Author: Kees Cook <keescook@xxxxxxxxxxxx>
Date:   Fri Nov 18 15:23:50 2022 -0800

    ALSA: seq: Fix function prototype mismatch in snd_seq_expand_var_event
    
    [ Upstream commit 05530ef7cf7c7d700f6753f058999b1b5099a026 ]
    
    With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG),
    indirect call targets are validated against the expected function
    pointer prototype to make sure the call target is valid to help mitigate
    ROP attacks. If they are not identical, there is a failure at run time,
    which manifests as either a kernel panic or thread getting killed.
    
    seq_copy_in_user() and seq_copy_in_kernel() did not have prototypes
    matching snd_seq_dump_func_t. Adjust this and remove the casts. There
    are not resulting binary output differences.
    
    This was found as a result of Clang's new -Wcast-function-type-strict
    flag, which is more sensitive than the simpler -Wcast-function-type,
    which only checks for type width mismatches.
    
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Link: https://lore.kernel.org/lkml/202211041527.HD8TLSE1-lkp@xxxxxxxxx
    Cc: Jaroslav Kysela <perex@xxxxxxxx>
    Cc: Takashi Iwai <tiwai@xxxxxxxx>
    Cc: "Gustavo A. R. Silva" <gustavoars@xxxxxxxxxx>
    Cc: alsa-devel@xxxxxxxxxxxxxxxx
    Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221118232346.never.380-kees@xxxxxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 4c8cbcd89887..42f4aa841051 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -126,15 +126,19 @@ EXPORT_SYMBOL(snd_seq_dump_var_event);
  * expand the variable length event to linear buffer space.
  */
 
-static int seq_copy_in_kernel(char **bufptr, const void *src, int size)
+static int seq_copy_in_kernel(void *ptr, void *src, int size)
 {
+	char **bufptr = ptr;
+
 	memcpy(*bufptr, src, size);
 	*bufptr += size;
 	return 0;
 }
 
-static int seq_copy_in_user(char __user **bufptr, const void *src, int size)
+static int seq_copy_in_user(void *ptr, void *src, int size)
 {
+	char __user **bufptr = ptr;
+
 	if (copy_to_user(*bufptr, src, size))
 		return -EFAULT;
 	*bufptr += size;
@@ -163,8 +167,7 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char
 		return newlen;
 	}
 	err = snd_seq_dump_var_event(event,
-				     in_kernel ? (snd_seq_dump_func_t)seq_copy_in_kernel :
-				     (snd_seq_dump_func_t)seq_copy_in_user,
+				     in_kernel ? seq_copy_in_kernel : seq_copy_in_user,
 				     &buf);
 	return err < 0 ? err : newlen;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux