uml: boot broken due to buffer overrun

mconsole_init() passed 256 bytes as length in os_create_unix_socket, while
the sizeof UNIX_PATH_MAX is 108. This patch fixes that problem and avoids
a big overrun bug reported on UML bootup.

sockaddr_un.sun_path is UNIX_PATH_MAX long which causes the problem.
Reported-by: Vikas K Managutte <vikki.km@gmail.com>
Reported-by: Sarvesh Kumar Lal Das <skldas@gmail.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Reviewed-by: WANG Cong <wangcong@zeuux.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: <stable@kernel.org> [please check with Jeff]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Balbir Singh and committed by Linus Torvalds 36137120 69fc208b

+3 -1
+3 -1
arch/um/drivers/mconsole_kern.c
··· 16 #include <linux/slab.h> 17 #include <linux/syscalls.h> 18 #include <linux/utsname.h> 19 #include <linux/workqueue.h> 20 #include <linux/mutex.h> 21 #include <asm/uaccess.h> ··· 787 /* long to avoid size mismatch warnings from gcc */ 788 long sock; 789 int err; 790 - char file[256]; 791 792 if (umid_file_name("mconsole", file, sizeof(file))) 793 return -1;
··· 16 #include <linux/slab.h> 17 #include <linux/syscalls.h> 18 #include <linux/utsname.h> 19 + #include <linux/socket.h> 20 + #include <linux/un.h> 21 #include <linux/workqueue.h> 22 #include <linux/mutex.h> 23 #include <asm/uaccess.h> ··· 785 /* long to avoid size mismatch warnings from gcc */ 786 long sock; 787 int err; 788 + char file[UNIX_PATH_MAX]; 789 790 if (umid_file_name("mconsole", file, sizeof(file))) 791 return -1;