lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 30 Jan 2014 08:24:30 -0600
From:	Dimitri Sivanich <sivanich@....com>
To:	Dan Carpenter <dan.carpenter@...cle.com>
Cc:	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [patch 2/2] gru: cleanup gru_dump_context() a little

Acked-by: Dimitri Sivanich <sivanich@....com>

On Thu, Jan 30, 2014 at 03:10:48PM +0300, Dan Carpenter wrote:
> "ret" is zero here so we can remove the "!ret" part of the condition.
> "uhdr" is alread a __user pointer so we can remove the cast.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
> Btw, speaking of __user pointers there are some places where we
> dereference them in this file.  It's not a security problem because we
> have already used copy_to_user() to successfully write to the pointer at
> point.  But if you have something like PAX which puts user pointers and
> kernel pointers in a separate address space then this will cause
> problems.
> 
> Run sparse to see the issue.
> 
> diff --git a/drivers/misc/sgi-gru/grukdump.c b/drivers/misc/sgi-gru/grukdump.c
> index 2bef3f76032a..a3700a56b8ff 100644
> --- a/drivers/misc/sgi-gru/grukdump.c
> +++ b/drivers/misc/sgi-gru/grukdump.c
> @@ -178,10 +178,10 @@ static int gru_dump_context(struct gru_state *gru, int ctxnum,
>  	hdr.cbrcnt = cbrcnt;
>  	hdr.dsrcnt = dsrcnt;
>  	hdr.cch_locked = cch_locked;
> -	if (!ret && copy_to_user((void __user *)uhdr, &hdr, sizeof(hdr)))
> -		ret = -EFAULT;
> +	if (copy_to_user(uhdr, &hdr, sizeof(hdr)))
> +		return -EFAULT;
>  
> -	return ret ? ret : bytes;
> +	return bytes;
>  }
>  
>  int gru_dump_chiplet_request(unsigned long arg)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ