projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ee495ad
)
IB/hfi: Protect against writable mmap
author
Ira Weiny
<
[email protected]
>
Sun, 9 Apr 2017 17:17:24 +0000
(10:17 -0700)
committer
Doug Ledford
<
[email protected]
>
Fri, 28 Apr 2017 17:56:23 +0000
(13:56 -0400)
The device/port status is not intended to be changed from user space.
Prevent a user from mapping them as write or execute.
Reviewed-by: Dennis Dalessandro <
[email protected]
>
Signed-off-by: Ira Weiny <
[email protected]
>
Signed-off-by: Dennis Dalessandro <
[email protected]
>
Signed-off-by: Doug Ledford <
[email protected]
>
drivers/infiniband/hw/hfi1/file_ops.c
patch
|
blob
|
history
diff --git
a/drivers/infiniband/hw/hfi1/file_ops.c
b/drivers/infiniband/hw/hfi1/file_ops.c
index 60598867f94837b1bd80b1c1637ad32fc0011ffd..3d9bce4bfcc7ac26c7b60d5a002881d3face49c9 100644
(file)
--- a/
drivers/infiniband/hw/hfi1/file_ops.c
+++ b/
drivers/infiniband/hw/hfi1/file_ops.c
@@
-597,6
+597,10
@@
static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
vmf = 1;
break;
case STATUS:
+ if (flags & (unsigned long)(VM_WRITE | VM_EXEC)) {
+ ret = -EPERM;
+ goto done;
+ }
memaddr = kvirt_to_phys((void *)dd->status);
memlen = PAGE_SIZE;
flags |= VM_IO | VM_DONTEXPAND;