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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150623135124.GP28762@mwanda>
Date:	Tue, 23 Jun 2015 16:51:24 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Dmitry Kalinkin <dmitry.kalinkin@...il.com>
Cc:	linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
	Martyn Welch <martyn.welch@...com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Manohar Vanga <manohar.vanga@...il.com>
Subject: Re: [PATCH 6/9] staging: vme_user: return -EFAULT on __copy_*_user
 errors

On Tue, Jun 23, 2015 at 03:42:30PM +0300, Dmitry Kalinkin wrote:
> @@ -178,38 +167,24 @@ static ssize_t buffer_to_user(unsigned int minor, char __user *buf,
>  			      size_t count, loff_t *ppos)
>  {
>  	void *image_ptr;
> -	ssize_t retval;
>  
>  	image_ptr = image[minor].kern_buf + *ppos;
> +	if (__copy_to_user(buf, image_ptr, (unsigned long)count))
> +		return -EINVAL;

s/EINVAL/EFAULT/

>  
> -	retval = __copy_to_user(buf, image_ptr, (unsigned long)count);
> -	if (retval != 0) {
> -		retval = (count - retval);
> -		pr_warn("Partial copy to userspace\n");
> -	} else
> -		retval = count;
> -
> -	/* Return number of bytes successfully read */
> -	return retval;
> +	return count;
>  }
>  
>  static ssize_t buffer_from_user(unsigned int minor, const char __user *buf,
>  				size_t count, loff_t *ppos)
>  {
>  	void *image_ptr;
> -	size_t retval;
>  
>  	image_ptr = image[minor].kern_buf + *ppos;
> +	if (__copy_from_user(image_ptr, buf, (unsigned long)count))
> +		return -EINVAL;

s/EINVAL/EFAULT/

>  
> -	retval = __copy_from_user(image_ptr, buf, (unsigned long)count);
> -	if (retval != 0) {
> -		retval = (count - retval);
> -		pr_warn("Partial copy to userspace\n");
> -	} else
> -		retval = count;
> -
> -	/* Return number of bytes successfully read */
> -	return retval;
> +	return count;
>  }

regards,
dan carpenter

--
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