lkml.org 
[lkml]   [2007]   [May]   [3]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 2 May 2007 21:20:53 -0700
FromAndrew Morton <>
SubjectRe: old buffer overflow in moxa driver
On Mon, 30 Apr 2007 16:48:29 -0600 dann frazier <dannf@hp.com> wrote:

> hey,
>   I noticed that the moxa input checking security bug described by
> CVE-2005-0504 appears to remain unfixed upstream.
> 
> The issue is described here:
>   http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-0504
> 
> Debian has been shipping the following patch from Andres Salomon. I
> tried contacting the listed maintainer a few months ago but received
> no response.
> 
> I've tested that this still applies to and compiles against 2.6.21.
> 
> Signed-off-by: dann frazier <dannf@hp.com>
> 
> diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
> index 7dbaee8..e0d35c2 100644
> --- a/drivers/char/moxa.c
> +++ b/drivers/char/moxa.c
> @@ -1582,7 +1582,7 @@ copy:
> 
>  	if(copy_from_user(&dltmp, argp, sizeof(struct dl_str)))
>  		return -EFAULT;
> -	if(dltmp.cardno < 0 || dltmp.cardno >= MAX_BOARDS)
> +	if(dltmp.cardno < 0 || dltmp.cardno >= MAX_BOARDS || dltmp.len < 0)
>  		return -EINVAL;
> 
>  	switch(cmd)
> @@ -2529,6 +2529,8 @@ static int moxaloadbios(int cardno, unsigned char __user *tmp, int len)
>  	void __iomem *baseAddr;
>  	int i;
> 
> +	if(len < 0 || len > sizeof(moxaBuff))
> +		return -EINVAL;
>  	if(copy_from_user(moxaBuff, tmp, len))
>  		return -EFAULT;
>  	baseAddr = moxa_boards[cardno].basemem;
> @@ -2576,7 +2578,7 @@ static int moxaload320b(int cardno, unsigned char __user *tmp, int len)
>  	void __iomem *baseAddr;
>  	int i;
> 
> -	if(len > sizeof(moxaBuff))
> +	if(len < 0 || len > sizeof(moxaBuff))
>  		return -EINVAL;
>  	if(copy_from_user(moxaBuff, tmp, len))
>  		return -EFAULT;
> @@ -2596,6 +2598,8 @@ static int moxaloadcode(int cardno, unsigned char __user *tmp, int len)
>  	void __iomem *baseAddr, *ofsAddr;
>  	int retval, port, i;
> 
> +	if(len < 0 || len > sizeof(moxaBuff))
> +		return -EINVAL;
>  	if(copy_from_user(moxaBuff, tmp, len))
>  		return -EFAULT;
>  	baseAddr = moxa_boards[cardno].basemem;
> 

I'm seeing copies of this patch floating around the internet from the 2.6.10
timeframe at least.

Could people please be more diligent about getting bugfixes back into
mainline?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-05-03 04:25    [from the cache]
©2003-2008