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>
This commit is contained in:
committed by
Linus Torvalds
parent
69fc208be5
commit
361371201b
@@ -16,6 +16,8 @@
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/utsname.h>
|
#include <linux/utsname.h>
|
||||||
|
#include <linux/socket.h>
|
||||||
|
#include <linux/un.h>
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
@@ -785,7 +787,7 @@ static int __init mconsole_init(void)
|
|||||||
/* long to avoid size mismatch warnings from gcc */
|
/* long to avoid size mismatch warnings from gcc */
|
||||||
long sock;
|
long sock;
|
||||||
int err;
|
int err;
|
||||||
char file[256];
|
char file[UNIX_PATH_MAX];
|
||||||
|
|
||||||
if (umid_file_name("mconsole", file, sizeof(file)))
|
if (umid_file_name("mconsole", file, sizeof(file)))
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user