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:   Thu, 23 Jul 2020 11:55:25 -0500
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Tomas Winkler <tomas.winkler@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Alexander Usyskin <alexander.usyskin@...el.com>,
        linux-kernel@...r.kernel.org,
        "Gustavo A . R . Silva" <gustavoars@...nel.org>,
        Arnd Bergmann <arnd@...db.de>
Subject: Re: [char-misc-next 2/6] mei: ioctl: use sizeof of variable instead
 of struct type



On 7/23/20 09:59, Tomas Winkler wrote:
> Use sizeof(connect_data))) instead of
> sizeof(struct mei_connect_client_data) when copying data
> between user space and kernel.
> 
> There is a possibility of bug when variable type has changed but
> corresponding struct passed to the sizeof has not.
> 
> Cc: Gustavo A. R. Silva <gustavoars@...nel.org>
> Signed-off-by: Tomas Winkler <tomas.winkler@...el.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>

Thanks
--
Gustavo

> ---
>  drivers/misc/mei/main.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
> index f17297f2943d..05e6ad6d4d54 100644
> --- a/drivers/misc/mei/main.c
> +++ b/drivers/misc/mei/main.c
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> - * Copyright (c) 2003-2018, Intel Corporation. All rights reserved.
> + * Copyright (c) 2003-2020, Intel Corporation. All rights reserved.
>   * Intel Management Engine Interface (Intel MEI) Linux driver
>   */
>  
> @@ -476,7 +476,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
>  	case IOCTL_MEI_CONNECT_CLIENT:
>  		dev_dbg(dev->dev, ": IOCTL_MEI_CONNECT_CLIENT.\n");
>  		if (copy_from_user(&connect_data, (char __user *)data,
> -				sizeof(struct mei_connect_client_data))) {
> +				   sizeof(connect_data))) {
>  			dev_dbg(dev->dev, "failed to copy data from userland\n");
>  			rets = -EFAULT;
>  			goto out;
> @@ -488,7 +488,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
>  
>  		/* if all is ok, copying the data back to user. */
>  		if (copy_to_user((char __user *)data, &connect_data,
> -				sizeof(struct mei_connect_client_data))) {
> +				 sizeof(connect_data))) {
>  			dev_dbg(dev->dev, "failed to copy data to userland\n");
>  			rets = -EFAULT;
>  			goto out;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ