aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-09 16:14:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-10 11:01:52 -0500
commit361371201b60ffd686a694c848c1d5ad6061725f (patch)
tree925f3fa0e62a5fc64840824dfd9a9aad36cb1076 /arch/um
parent69fc208be5b7eb18d22d1eca185b201400fd5ffc (diff)
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>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/mconsole_kern.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 19d579d74d27..8f44ebb0dec8 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -16,6 +16,8 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/syscalls.h> 17#include <linux/syscalls.h>
18#include <linux/utsname.h> 18#include <linux/utsname.h>
19#include <linux/socket.h>
20#include <linux/un.h>
19#include <linux/workqueue.h> 21#include <linux/workqueue.h>
20#include <linux/mutex.h> 22#include <linux/mutex.h>
21#include <asm/uaccess.h> 23#include <asm/uaccess.h>
@@ -785,7 +787,7 @@ static int __init mconsole_init(void)
785 /* long to avoid size mismatch warnings from gcc */ 787 /* long to avoid size mismatch warnings from gcc */
786 long sock; 788 long sock;
787 int err; 789 int err;
788 char file[256]; 790 char file[UNIX_PATH_MAX];
789 791
790 if (umid_file_name("mconsole", file, sizeof(file))) 792 if (umid_file_name("mconsole", file, sizeof(file)))
791 return -1; 793 return -1;