From 710cc7493c34f1622b948ef6f91279c154db61c0 Mon Sep 17 00:00:00 2001 From: John Stultz Date: Wed, 7 Oct 2020 06:08:59 +0000 Subject: [PATCH] ANDROID: inode_owner_or_capable called during execv Using old_creds as an indication that we are not overriding the credentials, bypass call to inode_owner_or_capable. Signed-off-by: Mark Salyzyn Signed-off-by: John Stultz Bug: 169988379 Fixes: 05acefb4872da ("ovl: check permission to open real file") Fixes: 6120a4d78045c ("FROMLIST: overlayfs: override_creds=off option bypass creator_cred") Change-Id: I6e8630de7367c93553e13a5c39c8e7011e90880a --- fs/overlayfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index 81a53839756e..672792db9f41 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -53,7 +53,7 @@ static struct file *ovl_open_realfile(const struct file *file, err = inode_permission(realinode, MAY_OPEN | acc_mode); if (err) { realfile = ERR_PTR(err); - } else if (!inode_owner_or_capable(realinode)) { + } else if (old_cred && !inode_owner_or_capable(realinode)) { realfile = ERR_PTR(-EPERM); } else { realfile = open_with_fake_path(&file->f_path, flags, realinode,