Re: [linux-next PATCH v3] drivers/virt/fsl_hypervisor: Fix error handling path

2020-09-01 Thread John Hubbard
On 9/1/20 1:14 PM, Souptick Joarder wrote: Hi John, On Tue, Sep 1, 2020 at 4:28 AM John Hubbard wrote: On 8/31/20 3:07 PM, Souptick Joarder wrote: First, when memory allocation for sg_list_unaligned failed, there is a bug of calling put_pages() as we haven't pinned any pages. "we should

Re: [linux-next PATCH v3] drivers/virt/fsl_hypervisor: Fix error handling path

2020-09-01 Thread Souptick Joarder
Hi John, On Tue, Sep 1, 2020 at 4:28 AM John Hubbard wrote: > > On 8/31/20 3:07 PM, Souptick Joarder wrote: > > First, when memory allocation for sg_list_unaligned failed, there > > is a bug of calling put_pages() as we haven't pinned any pages. > > "we should unpin" will it be "we shouldn't

Re: [linux-next PATCH v3] drivers/virt/fsl_hypervisor: Fix error handling path

2020-08-31 Thread John Hubbard
On 8/31/20 3:10 PM, Souptick Joarder wrote: Hi John, On Tue, Sep 1, 2020 at 3:38 AM Souptick Joarder wrote: First, when memory allocation for sg_list_unaligned failed, there is a bug of calling put_pages() as we haven't pinned any pages. Second, if get_user_pages_fast() failed we should

Re: [linux-next PATCH v3] drivers/virt/fsl_hypervisor: Fix error handling path

2020-08-31 Thread John Hubbard
On 8/31/20 3:07 PM, Souptick Joarder wrote: First, when memory allocation for sg_list_unaligned failed, there is a bug of calling put_pages() as we haven't pinned any pages. "we should unpin" ... @@ -250,7 +250,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)

Re: [linux-next PATCH v3] drivers/virt/fsl_hypervisor: Fix error handling path

2020-08-31 Thread Souptick Joarder
Hi John, On Tue, Sep 1, 2020 at 3:38 AM Souptick Joarder wrote: > > First, when memory allocation for sg_list_unaligned failed, there > is a bug of calling put_pages() as we haven't pinned any pages. > > Second, if get_user_pages_fast() failed we should unpinned num_pinned > pages instead of

[linux-next PATCH v3] drivers/virt/fsl_hypervisor: Fix error handling path

2020-08-31 Thread Souptick Joarder
First, when memory allocation for sg_list_unaligned failed, there is a bug of calling put_pages() as we haven't pinned any pages. Second, if get_user_pages_fast() failed we should unpinned num_pinned pages instead of checking till num_pages. This will address both. As part of these changes,