From 50692f8c6b6a27ffed9b5b7206ca6682a60ff354 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Fri, 18 Jul 2003 18:37:17 -0700 Subject: [PATCH] [PATCH] janitor: mem leak and copy_from_user in wan/comx driver author: Daniele Bellucci Fix a memory leak and checks a copy_from_user in wan/comx driver. --- drivers/net/wan/comx-hw-comx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/wan/comx-hw-comx.c b/drivers/net/wan/comx-hw-comx.c index e57c8cf9dfca1..17d797e727b12 100644 --- a/drivers/net/wan/comx-hw-comx.c +++ b/drivers/net/wan/comx-hw-comx.c @@ -11,6 +11,7 @@ * * Contributors: * Arnaldo Carvalho de Melo - 0.86 + * Daniele Bellucci - 0.87 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,9 +43,12 @@ * - printk cleanups * Version 0.86 (00/08/15): * - resource release on failure at COMX_init + * + * Version 0.87 (03/07/09) + * - audit copy_from_user in comxhw_write_proc */ -#define VERSION "0.86" +#define VERSION "0.87" #include #include @@ -1084,7 +1088,8 @@ static int comxhw_write_proc(struct file *file, const char *buffer, if (hw->firmware->data) { kfree(hw->firmware->data); } - copy_from_user(tmp + file->f_pos, buffer, count); + if (copy_from_user(tmp + file->f_pos, buffer, count)) + return -EFAULT; hw->firmware->len = entry->size = file->f_pos + count; hw->firmware->data = tmp; file->f_pos += count; -- 2.53.0