[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a1581cc4-fa0c-22eb-0a2c-62f1a1a1e215@pensando.io>
Date: Tue, 13 Apr 2021 09:01:54 -0700
From: Shannon Nelson <snelson@...sando.io>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: drivers@...sando.io, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Allen Hubbe <allenbh@...sando.io>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net-next] ionic: return -EFAULT if copy_to_user() fails
On 4/13/21 3:47 AM, Dan Carpenter wrote:
> The copy_to_user() function returns the number of bytes that it wasn't
> able to copy. We want to return -EFAULT to the user.
>
> Fixes: fee6efce565d ("ionic: add hw timestamp support files")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Acked-by: Shannon Nelson <snelson@...sando.io>
> ---
> drivers/net/ethernet/pensando/ionic/ionic_phc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_phc.c b/drivers/net/ethernet/pensando/ionic/ionic_phc.c
> index 86ae5011ac9b..d7d8d5e81ea0 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_phc.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_phc.c
> @@ -225,7 +225,9 @@ int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr)
> memcpy(&config, &lif->phc->ts_config, sizeof(config));
> mutex_unlock(&lif->phc->config_lock);
>
> - return copy_to_user(ifr->ifr_data, &config, sizeof(config));
> + if (copy_to_user(ifr->ifr_data, &config, sizeof(config)))
> + return -EFAULT;
> + return 0;
> }
>
> static u64 ionic_hwstamp_read(struct ionic *ionic,
Powered by blists - more mailing lists