diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2021-04-13 13:47:59 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-04-13 15:08:18 -0700 |
commit | 5871d0c6b8ea805916c3135d0c53b095315bc674 (patch) | |
tree | a05a4db2c47e04b0e9309dd9f998fc38b3d35a6e /drivers/net/ethernet/pensando/ionic | |
parent | 23ba511722706be1c5e8f2c74e8ec9bd69e57ce2 (diff) | |
download | linux-stable-5871d0c6b8ea805916c3135d0c53b095315bc674.tar.gz linux-stable-5871d0c6b8ea805916c3135d0c53b095315bc674.tar.bz2 linux-stable-5871d0c6b8ea805916c3135d0c53b095315bc674.zip |
ionic: return -EFAULT if copy_to_user() fails
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/pensando/ionic')
-rw-r--r-- | drivers/net/ethernet/pensando/ionic/ionic_phc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_phc.c b/drivers/net/ethernet/pensando/ionic/ionic_phc.c index 177dbf89affd..a87c87e86aef 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, |