Skip to content

Commit

Permalink
[ALPS05914317] SDCARDFS: add back
Browse files Browse the repository at this point in the history
We add back sdcardfs in 4.19 due to OTA and some legacy
apks of MTK:
 - uxjack apk needs to use FUSE APIs
 - avoid case-insensitive filename feature effect

MTK-Commit-Id: 265ee40dcc2b49bf804fc4d701576fb6d447181b

Change-Id: I07cce3588e51118f402a2a306fe05c322c1b61a6
Signed-off-by: Peng Zhou <[email protected]>
CR-Id: ALPS05914317
Feature: [Android Default] Sdcard File System
  • Loading branch information
pengzhou777 committed Aug 4, 2021
1 parent b5a5366 commit c73dd29
Show file tree
Hide file tree
Showing 32 changed files with 5,248 additions and 88 deletions.
1 change: 1 addition & 0 deletions drivers/misc/mediatek/Kconfig.default
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ config ANDROID_DEFAULT_SETTING
select QUOTACTL
select RTC_CLASS
select SCHED_DEBUG
select SDCARD_FS
select SECCOMP
select SECCOMP_FILTER
select SECURITY
Expand Down
1 change: 1 addition & 0 deletions fs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ source "fs/orangefs/Kconfig"
source "fs/adfs/Kconfig"
source "fs/affs/Kconfig"
source "fs/ecryptfs/Kconfig"
source "fs/sdcardfs/Kconfig"
source "fs/hfs/Kconfig"
source "fs/hfsplus/Kconfig"
source "fs/befs/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ obj-$(CONFIG_ISO9660_FS) += isofs/
obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+
obj-$(CONFIG_HFS_FS) += hfs/
obj-$(CONFIG_ECRYPT_FS) += ecryptfs/
obj-$(CONFIG_SDCARD_FS) += sdcardfs/
obj-$(CONFIG_VXFS_FS) += freevxfs/
obj-$(CONFIG_NFS_FS) += nfs/
obj-$(CONFIG_EXPORTFS) += exportfs/
Expand Down
14 changes: 11 additions & 3 deletions fs/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ EXPORT_SYMBOL(setattr_copy);
* the file open for write, as there can be no conflicting delegation in
* that case.
*/
int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **delegated_inode)
int notify_change2(struct vfsmount *mnt, struct dentry * dentry, struct iattr * attr, struct inode **delegated_inode)
{
struct inode *inode = dentry->d_inode;
umode_t mode = inode->i_mode;
Expand All @@ -247,7 +247,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
return -EPERM;

if (!inode_owner_or_capable(inode)) {
error = inode_permission(inode, MAY_WRITE);
error = inode_permission2(mnt, inode, MAY_WRITE);
if (error)
return error;
}
Expand Down Expand Up @@ -330,7 +330,9 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
if (error)
return error;

if (inode->i_op->setattr)
if (mnt && inode->i_op->setattr2)
error = inode->i_op->setattr2(mnt, dentry, attr);
else if (inode->i_op->setattr)
error = inode->i_op->setattr(dentry, attr);
else
error = simple_setattr(dentry, attr);
Expand All @@ -343,4 +345,10 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de

return error;
}
EXPORT_SYMBOL_GPL(notify_change2);

int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **delegated_inode)
{
return notify_change2(NULL, dentry, attr, delegated_inode);
}
EXPORT_SYMBOL(notify_change);
2 changes: 1 addition & 1 deletion fs/coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ void do_coredump(const siginfo_t *siginfo)
goto close_fail;
if (!(cprm.file->f_mode & FMODE_CAN_WRITE))
goto close_fail;
if (do_truncate(cprm.file->f_path.dentry, 0, 0, cprm.file))
if (do_truncate2(cprm.file->f_path.mnt, cprm.file->f_path.dentry, 0, 0, cprm.file))
goto close_fail;
}

Expand Down
22 changes: 22 additions & 0 deletions fs/crypto/keyring.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,12 +867,34 @@ static int check_for_busy_inodes(struct super_block *sb,
return -EBUSY;
}

static BLOCKING_NOTIFIER_HEAD(fscrypt_key_removal_notifiers);

/*
* Register a function to be executed when the FS_IOC_REMOVE_ENCRYPTION_KEY
* ioctl has removed a key and is about to try evicting inodes.
*/
int fscrypt_register_key_removal_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&fscrypt_key_removal_notifiers,
nb);
}
EXPORT_SYMBOL_GPL(fscrypt_register_key_removal_notifier);

int fscrypt_unregister_key_removal_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&fscrypt_key_removal_notifiers,
nb);
}
EXPORT_SYMBOL_GPL(fscrypt_unregister_key_removal_notifier);

static int try_to_lock_encrypted_files(struct super_block *sb,
struct fscrypt_master_key *mk)
{
int err1;
int err2;

blocking_notifier_call_chain(&fscrypt_key_removal_notifiers, 0, NULL);

/*
* An inode can't be evicted while it is dirty or has dirty pages.
* Thus, we first have to clean the inodes in ->mk_decrypted_inodes.
Expand Down
2 changes: 1 addition & 1 deletion fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ EXPORT_SYMBOL(flush_old_exec);
void would_dump(struct linux_binprm *bprm, struct file *file)
{
struct inode *inode = file_inode(file);
if (inode_permission(inode, MAY_READ) < 0) {
if (inode_permission2(file->f_path.mnt, inode, MAY_READ) < 0) {
struct user_namespace *old, *user_ns;
bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;

Expand Down
6 changes: 3 additions & 3 deletions fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,7 @@ int dentry_needs_remove_privs(struct dentry *dentry)
return mask;
}

static int __remove_privs(struct dentry *dentry, int kill)
static int __remove_privs(struct vfsmount *mnt, struct dentry *dentry, int kill)
{
struct iattr newattrs;

Expand All @@ -1812,7 +1812,7 @@ static int __remove_privs(struct dentry *dentry, int kill)
* Note we call this on write, so notify_change will not
* encounter any conflicting delegations:
*/
return notify_change(dentry, &newattrs, NULL);
return notify_change2(mnt, dentry, &newattrs, NULL);
}

/*
Expand All @@ -1839,7 +1839,7 @@ int file_remove_privs(struct file *file)
if (kill < 0)
return kill;
if (kill)
error = __remove_privs(dentry, kill);
error = __remove_privs(file->f_path.mnt, dentry, kill);
if (!error)
inode_has_no_xattr(inode);

Expand Down
Loading

0 comments on commit c73dd29

Please sign in to comment.