diff mbox

[v3,12/18] powerpc/iommu: Fix missing permission bits in iommu_put_tce_user_mode()

Message ID 1406191691-31441-13-git-send-email-aik@ozlabs.ru (mailing list archive)
State Superseded
Headers show

Commit Message

Alexey Kardashevskiy July 24, 2014, 8:48 a.m. UTC
This adds missing permission bits to the translated TCE.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 arch/powerpc/kernel/iommu.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Benjamin Herrenschmidt July 28, 2014, 1:19 a.m. UTC | #1
On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote:
> This adds missing permission bits to the translated TCE.

Is this a bug fix for existing stuff ? If yes, submit it separately.

> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  arch/powerpc/kernel/iommu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
> index 0cda2e8..5af2319 100644
> --- a/arch/powerpc/kernel/iommu.c
> +++ b/arch/powerpc/kernel/iommu.c
> @@ -1088,6 +1088,7 @@ int iommu_put_tce_user_mode(struct iommu_table *tbl, unsigned long entry,
>  		return -EFAULT;
>  	}
>  	hwaddr = (unsigned long) page_address(page) + offset;
> +	hwaddr |= tce & (TCE_PCI_READ | TCE_PCI_WRITE);
>  
>  	ret = iommu_tce_build(tbl, entry, hwaddr, direction);
>  	if (ret)
Alexey Kardashevskiy July 28, 2014, 4:32 a.m. UTC | #2
On 07/28/2014 11:19 AM, Benjamin Herrenschmidt wrote:
> On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote:
>> This adds missing permission bits to the translated TCE.
> 
> Is this a bug fix for existing stuff ? If yes, submit it separately.


There is 15/18 patch which fixes possible bug with leaking pages, and that
patch won't work until this one is applied.

Merge this one and "[PATCH v3 15/18] powerpc/iommu: Implement put_page() if
TCE had non-zero value"?




> 
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>> ---
>>  arch/powerpc/kernel/iommu.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
>> index 0cda2e8..5af2319 100644
>> --- a/arch/powerpc/kernel/iommu.c
>> +++ b/arch/powerpc/kernel/iommu.c
>> @@ -1088,6 +1088,7 @@ int iommu_put_tce_user_mode(struct iommu_table *tbl, unsigned long entry,
>>  		return -EFAULT;
>>  	}
>>  	hwaddr = (unsigned long) page_address(page) + offset;
>> +	hwaddr |= tce & (TCE_PCI_READ | TCE_PCI_WRITE);
>>  
>>  	ret = iommu_tce_build(tbl, entry, hwaddr, direction);
>>  	if (ret)
> 
>
Benjamin Herrenschmidt July 28, 2014, 4:35 a.m. UTC | #3
On Mon, 2014-07-28 at 14:32 +1000, Alexey Kardashevskiy wrote:
> On 07/28/2014 11:19 AM, Benjamin Herrenschmidt wrote:
> > On Thu, 2014-07-24 at 18:48 +1000, Alexey Kardashevskiy wrote:
> >> This adds missing permission bits to the translated TCE.
> > 
> > Is this a bug fix for existing stuff ? If yes, submit it separately.
> 
> 
> There is 15/18 patch which fixes possible bug with leaking pages, and that
> patch won't work until this one is applied.

Please collapse them then.

> Merge this one and "[PATCH v3 15/18] powerpc/iommu: Implement put_page() if
> TCE had non-zero value"?

Right, and if the result is a bug fix on top of something already
upstream, please send it separately.

Cheers,
Ben.

> 
> 
> > 
> >> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> >> ---
> >>  arch/powerpc/kernel/iommu.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
> >> index 0cda2e8..5af2319 100644
> >> --- a/arch/powerpc/kernel/iommu.c
> >> +++ b/arch/powerpc/kernel/iommu.c
> >> @@ -1088,6 +1088,7 @@ int iommu_put_tce_user_mode(struct iommu_table *tbl, unsigned long entry,
> >>  		return -EFAULT;
> >>  	}
> >>  	hwaddr = (unsigned long) page_address(page) + offset;
> >> +	hwaddr |= tce & (TCE_PCI_READ | TCE_PCI_WRITE);
> >>  
> >>  	ret = iommu_tce_build(tbl, entry, hwaddr, direction);
> >>  	if (ret)
> > 
> > 
> 
>
diff mbox

Patch

diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 0cda2e8..5af2319 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -1088,6 +1088,7 @@  int iommu_put_tce_user_mode(struct iommu_table *tbl, unsigned long entry,
 		return -EFAULT;
 	}
 	hwaddr = (unsigned long) page_address(page) + offset;
+	hwaddr |= tce & (TCE_PCI_READ | TCE_PCI_WRITE);
 
 	ret = iommu_tce_build(tbl, entry, hwaddr, direction);
 	if (ret)