From: Shannon Nelson <snelson@pensando.io>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: drivers@pensando.io, "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Allen Hubbe <allenbh@pensando.io>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net-next] ionic: return -EFAULT if copy_to_user() fails
Date: Tue, 13 Apr 2021 09:01:54 -0700 [thread overview]
Message-ID: <a1581cc4-fa0c-22eb-0a2c-62f1a1a1e215@pensando.io> (raw)
In-Reply-To: <YHV230jUzxBJxlPS@mwanda>
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,
next prev parent reply other threads:[~2021-04-13 16:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2021-04-13 22:10 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a1581cc4-fa0c-22eb-0a2c-62f1a1a1e215@pensando.io \
--to=snelson@pensando.io \
--cc=allenbh@pensando.io \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=drivers@pensando.io \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).