Skip to content

Commit 0d67f0d

Browse files
hmynenimaddy-kerneldev
authored andcommitted
powerpc/vas: Return -EINVAL if the offset is non-zero in mmap()
The user space calls mmap() to map VAS window paste address and the kernel returns the complete mapped page for each window. So return -EINVAL if non-zero is passed for offset parameter to mmap(). See Documentation/arch/powerpc/vas-api.rst for mmap() restrictions. Co-developed-by: Jonathan Greental <[email protected]> Signed-off-by: Jonathan Greental <[email protected]> Reported-by: Jonathan Greental <[email protected]> Fixes: dda44eb ("powerpc/vas: Add VAS user space API") Signed-off-by: Haren Myneni <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent cd097df commit 0d67f0d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

arch/powerpc/platforms/book3s/vas-api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,15 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
521521
return -EINVAL;
522522
}
523523

524+
/*
525+
* Map complete page to the paste address. So the user
526+
* space should pass 0ULL to the offset parameter.
527+
*/
528+
if (vma->vm_pgoff) {
529+
pr_debug("Page offset unsupported to map paste address\n");
530+
return -EINVAL;
531+
}
532+
524533
/* Ensure instance has an open send window */
525534
if (!txwin) {
526535
pr_err("No send window open?\n");

0 commit comments

Comments
 (0)