summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyon Wang <lyon.wang@mediatek.com>2023-10-30 19:22:31 +0800
committerHao Han Wang <lyon.wang@mediatek.com>2023-11-02 07:56:14 +0000
commit47e30b4060c43613523b256168f0e7f5bd7c4724 (patch)
tree6d4c79ef570b238cf01fcbdb53836da678162624
parent2fea3eca9608d8c14fb6963bfe830dfa5985d7de (diff)
downloadcommon-47e30b4060c43613523b256168f0e7f5bd7c4724.tar.gz
ANDROID: fs/passthrough: Fix compatibility with R/O file system
Look at the passthrough file and check to see if its mount is read-only. Bug: 297482438 Signed-off-by: Lyon Wang <lyon.wang@mediatek.com> Change-Id: I0f483c6bcb1effe395eee07b6d721f343840d115 (cherry picked from commit dbeed231965e1a01bf0d70ea5439fbfacc7c4aae)
-rw-r--r--fs/fuse/passthrough.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c
index 6031e72f3b5a..1845e05db2da 100644
--- a/fs/fuse/passthrough.c
+++ b/fs/fuse/passthrough.c
@@ -213,7 +213,8 @@ int fuse_passthrough_open(struct fuse_dev *fud, u32 lower_fd)
}
if (!passthrough_filp->f_op->read_iter ||
- !passthrough_filp->f_op->write_iter) {
+ !((passthrough_filp->f_path.mnt->mnt_flags | MNT_READONLY) ||
+ passthrough_filp->f_op->write_iter)) {
pr_err("FUSE: passthrough file misses file operations.\n");
res = -EBADF;
goto err_free_file;