kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Diana Craciun OSS <diana.craciun@oss.nxp.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Bharat Bhushan <Bharat.Bhushan@nxp.com>,
	Eric Auger <eric.auger@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] vfio/fsl-mc: return -EFAULT if copy_to_user() fails
Date: Tue, 3 Nov 2020 19:19:44 +0200	[thread overview]
Message-ID: <28a51535-5f4f-6a06-254e-29ef3dc999ba@oss.nxp.com> (raw)
In-Reply-To: <20201102144536.42a0e066@w520.home>

On 11/2/2020 11:45 PM, Alex Williamson wrote:
> 
> Thanks, Dan.
> 
> Diana, can I get an ack for this?  Thanks,


Yes, sure, I apologize for not doing it earlier.

Thanks,
Diana

> 
> Alex
> 
> On Fri, 23 Oct 2020 14:34:50 +0300
> Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
>> The copy_to_user() function returns the number of bytes remaining to be
>> copied, but this code should return -EFAULT.
>>
>> Fixes: df747bcd5b21 ("vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>>   drivers/vfio/fsl-mc/vfio_fsl_mc.c | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
>> index 0113a980f974..21f22e3da11f 100644
>> --- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c
>> +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
>> @@ -248,7 +248,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd,
>>   		info.size = vdev->regions[info.index].size;
>>   		info.flags = vdev->regions[info.index].flags;
>>   
>> -		return copy_to_user((void __user *)arg, &info, minsz);
>> +		if (copy_to_user((void __user *)arg, &info, minsz))
>> +			return -EFAULT;
>> +		return 0;
>>   	}
>>   	case VFIO_DEVICE_GET_IRQ_INFO:
>>   	{
>> @@ -267,7 +269,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd,
>>   		info.flags = VFIO_IRQ_INFO_EVENTFD;
>>   		info.count = 1;
>>   
>> -		return copy_to_user((void __user *)arg, &info, minsz);
>> +		if (copy_to_user((void __user *)arg, &info, minsz))
>> +			return -EFAULT;
>> +		return 0;
>>   	}
>>   	case VFIO_DEVICE_SET_IRQS:
>>   	{
> 


  reply	other threads:[~2020-11-03 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 11:34 [PATCH 1/2] vfio/fsl-mc: return -EFAULT if copy_to_user() fails Dan Carpenter
2020-11-02 21:45 ` Alex Williamson
2020-11-03 17:19   ` Diana Craciun OSS [this message]
2020-11-03 12:01 ` Diana Craciun OSS
2020-11-03 18:19 ` Alex Williamson

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=28a51535-5f4f-6a06-254e-29ef3dc999ba@oss.nxp.com \
    --to=diana.craciun@oss.nxp.com \
    --cc=Bharat.Bhushan@nxp.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=dan.carpenter@oracle.com \
    --cc=eric.auger@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@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).