diff options
author | Suman Anna <s-anna@ti.com> | 2018-08-16 22:07:52 -0500 |
---|---|---|
committer | Sam Nelson <sam.nelson@ti.com> | 2018-08-17 23:06:59 -0400 |
commit | fb0ff9e29b4f5fc71d8489a7622e799f54860ee6 (patch) | |
tree | 509535d308bd2b2e100c7642bf8988ce57d32f3c | |
parent | 000038a65af9428b559de5e00e4a7588892ad7b0 (diff) | |
download | linuxutils-fb0ff9e29b4f5fc71d8489a7622e799f54860ee6.tar.gz |
cmemk: Fix mmap failures on K2 devices with v4.14.49
The commit 16d7ceb04b55 ("mmap: introduce sane default mmap limits")
that came through v4.14.49 stable tree has added additional range
checks that resulted in the mmap() calls on the CMEM device to fail
on K2 SoCs. K2 SoCs use 36-bit address spaces and the range check
fails when comparing (in page indices) the 33-bit physical address
against the 4 GB address imit, resulting in CMEM API failures and
unable to launch MPM daemon on K2 SoCs affecting all MPM based IPC
use-cases.
Work around this problem by setting FMODE_UNSIGNED_OFFSET in the file
flags in the driver's open() fops implementation for the /dev/cmem
device. The change follows the suggestion in the above commit to mark
the file descriptors as safe in the full 64-bit mmap address space
by using the repurposed FMODE_UNSIGNED_OFFSET bit. The fix was also
inspired by a similar fix in commit 2abd4c3ed20d ("drm: set
FMODE_UNSIGNED_OFFSET for drm files") for the same problem.
The same fix applies when using CMEM against kernels v4.17-rc5 and
above as well overcoming the corresponding upstream equivalent commit
be83bbf80682 ("mmap: introduce sane default mmap limits").
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Sam Nelson <sam.nelson@ti.com>
-rw-r--r-- | src/cmem/module/cmemk.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmem/module/cmemk.c b/src/cmem/module/cmemk.c index 53444a7..1c152e4 100644 --- a/src/cmem/module/cmemk.c +++ b/src/cmem/module/cmemk.c @@ -2259,6 +2259,7 @@ static int open(struct inode *inode, struct file *filp) __D("open: called.\n"); atomic_inc(&reference_count); + filp->f_mode |= FMODE_UNSIGNED_OFFSET; return 0; } |