netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ionic: return -EFAULT if copy_to_user() fails
@ 2021-04-13 10:47 Dan Carpenter
  2021-04-13 16:01 ` Shannon Nelson
  2021-04-13 22:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-04-13 10:47 UTC (permalink / raw)
  To: Shannon Nelson
  Cc: drivers, David S. Miller, Jakub Kicinski, Allen Hubbe, netdev,
	kernel-janitors

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@oracle.com>
---
 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,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ionic: return -EFAULT if copy_to_user() fails
  2021-04-13 10:47 [PATCH net-next] ionic: return -EFAULT if copy_to_user() fails Dan Carpenter
@ 2021-04-13 16:01 ` Shannon Nelson
  2021-04-13 22:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Shannon Nelson @ 2021-04-13 16:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: drivers, David S. Miller, Jakub Kicinski, Allen Hubbe, netdev,
	kernel-janitors

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@oracle.com>

Acked-by: Shannon Nelson <snelson@pensando.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,


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ionic: return -EFAULT if copy_to_user() fails
  2021-04-13 10:47 [PATCH net-next] ionic: return -EFAULT if copy_to_user() fails Dan Carpenter
  2021-04-13 16:01 ` Shannon Nelson
@ 2021-04-13 22:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-13 22:10 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: snelson, drivers, davem, kuba, allenbh, netdev, kernel-janitors

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue, 13 Apr 2021 13:47:59 +0300 you 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@oracle.com>
> ---
>  drivers/net/ethernet/pensando/ionic/ionic_phc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [net-next] ionic: return -EFAULT if copy_to_user() fails
    https://git.kernel.org/netdev/net-next/c/5871d0c6b8ea

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-13 22:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 10:47 [PATCH net-next] ionic: return -EFAULT if copy_to_user() fails Dan Carpenter
2021-04-13 16:01 ` Shannon Nelson
2021-04-13 22:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).