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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 13 Jun 2018 12:16:49 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Hugo Lefeuvre <hle@....eu.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        devel@...verdev.osuosl.org,
        Marcus Wolf <linux@...f-entwicklungen.de>,
        linux-kernel@...r.kernel.org, kernelnewbies@...nelnewbies.org
Subject: Re: [PATCH v2] staging: pi433: fix race condition in pi433_ioctl

On Tue, Jun 12, 2018 at 09:47:41PM -0400, Hugo Lefeuvre wrote:
>  drivers/staging/pi433/pi433_if.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index b061f77dda41..3ec1ed01d04b 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -880,6 +880,7 @@ pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>  	int			retval = 0;
>  	struct pi433_instance	*instance;
>  	struct pi433_device	*device;
> +	struct pi433_tx_cfg	tx_cfg_buffer;
>  	void __user *argp = (void __user *)arg;
>  
>  	/* Check type and command number */
> @@ -902,9 +903,15 @@ pi433_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>  			return -EFAULT;
>  		break;
>  	case PI433_IOC_WR_TX_CFG:
> -		if (copy_from_user(&instance->tx_cfg, argp,
> -				   sizeof(struct pi433_tx_cfg)))
> +		/* do not modify tx config while it is being copied to fifo */

There is no need for this comment, since it's obvious.  Also if you use
simpler names then the copy fits on one line:

		if (copy_from_user(&tx_cfg, argp, sizeof(tx_cfg)) {


> +		mutex_lock(&device->tx_fifo_lock);
> +		if (copy_from_user(&tx_cfg_buffer, argp,
> +				   sizeof(struct pi433_tx_cfg))) {

Sorry for the duplicate review, but it got sent to both my inboxes... :P

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ