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: <de9a7ffe-bedd-4181-886d-c9a3006b7be8@roeck-us.net>
Date:   Mon, 22 May 2023 15:30:06 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Su Hui <suhui@...china.com>
Cc:     Jeremy Kerr <jk@...abs.org>, Joel Stanley <joel@....id.au>,
        Alistar Popple <alistair@...ple.id.au>,
        Eddie James <eajames@...ux.ibm.com>, eajames@...ibm.com,
        kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
        cbostic@...ux.vnet.ibm.com, linux-fsi@...ts.ozlabs.org
Subject: Re: [PATCH] drivers/fsi/scom: Return -EFAULT if copy fails

On Fri, May 19, 2023 at 09:37:10AM +0800, Su Hui wrote:
> The copy_to/from_user() functions return the number of bytes remaining
> to be copied, but we want to return -EFAULT to the user.
> 
Why ? EFAULT means that a bad address was provided, and it is not
immediately obvious why that would be the case.

Guenter

> Fixes: 680ca6dcf5c2 ("drivers/fsi: Add SCOM FSI client device driver")
> Signed-off-by: Su Hui <suhui@...china.com>
> ---
>  drivers/fsi/fsi-scom.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
> index bcb756dc9866..caaf7738eb98 100644
> --- a/drivers/fsi/fsi-scom.c
> +++ b/drivers/fsi/fsi-scom.c
> @@ -335,7 +335,7 @@ static ssize_t scom_read(struct file *filep, char __user *buf, size_t len,
>  	if (rc)
>  		dev_dbg(dev, "copy to user failed:%d\n", rc);
>  
> -	return rc ? rc : len;
> +	return rc ? -EFAULT : len;
>  }
>  
>  static ssize_t scom_write(struct file *filep, const char __user *buf,
> -- 
> 2.30.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ