diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fat/dir.c | 9 | ||||
-rw-r--r-- | fs/fat/fat.h | 1 | ||||
-rw-r--r-- | fs/partitions/check.c | 9 | ||||
-rw-r--r-- | fs/proc/base.c | 35 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 3 |
5 files changed, 55 insertions, 2 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 530b4ca01510..4ceff5110417 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c @@ -758,6 +758,13 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *filp, return ret; } +static int fat_ioctl_volume_id(struct inode *dir) +{ + struct super_block *sb = dir->i_sb; + struct msdos_sb_info *sbi = MSDOS_SB(sb); + return sbi->vol_id; +} + static int fat_dir_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -773,6 +780,8 @@ static int fat_dir_ioctl(struct inode *inode, struct file *filp, short_only = 0; both = 1; break; + case VFAT_IOCTL_GET_VOLUME_ID: + return fat_ioctl_volume_id(inode); default: return fat_generic_ioctl(inode, filp, cmd, arg); } diff --git a/fs/fat/fat.h b/fs/fat/fat.h index adb0e72a176d..09305185330f 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -76,6 +76,7 @@ struct msdos_sb_info { const void *dir_ops; /* Opaque; default directory operations */ int dir_per_block; /* dir entries per block */ int dir_per_block_bits; /* log2(dir_per_block) */ + unsigned long vol_id; /* volume ID */ int fatent_shift; struct fatent_operations *fatent_ops; diff --git a/fs/partitions/check.c b/fs/partitions/check.c index ea4e6cb29e13..5ff78a202e0a 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -317,10 +317,19 @@ static void part_release(struct device *dev) kfree(p); } +static int part_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + struct hd_struct *part = dev_to_part(dev); + + add_uevent_var(env, "PARTN=%u", part->partno); + return 0; +} + struct device_type part_type = { .name = "partition", .groups = part_attr_groups, .release = part_release, + .uevent = part_uevent, }; static void delete_partition_rcu_cb(struct rcu_head *head) diff --git a/fs/proc/base.c b/fs/proc/base.c index 6f742f6658a9..a0f94952faf2 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -127,6 +127,8 @@ struct pid_entry { NOD(NAME, (S_IFREG|(MODE)), \ NULL, &proc_single_file_operations, \ { .proc_show = show } ) +#define ARD(NAME, MODE, iops, fops) \ + NOD(NAME, (S_IFREG|(MODE)), &iops, &fops, {} ) /* * Count the number of hardlinks for the pid_entry table, excluding the . @@ -1043,6 +1045,35 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, return end - buffer; } +#ifdef CONFIG_ANDROID +static int oom_adjust_permission(struct inode *inode, int mask) +{ + uid_t uid; + struct task_struct *p = get_proc_task(inode); + if(p) { + uid = task_uid(p); + put_task_struct(p); + } + + /* + * System Server (uid == 1000) is granted access to oom_adj of all + * android applications (uid > 10000) as and services (uid >= 1000) + */ + if (p && (current_fsuid() == 1000) && (uid >= 1000)) { + if (inode->i_mode >> 6 & mask) { + return 0; + } + } + + /* Fall back to default. */ + return generic_permission(inode, mask, NULL); +} + +static const struct inode_operations proc_oom_adjust_inode_operations = { + .permission = oom_adjust_permission, +}; +#endif + static const struct file_operations proc_oom_adjust_operations = { .read = oom_adjust_read, .write = oom_adjust_write, @@ -2531,7 +2562,11 @@ static const struct pid_entry tgid_base_stuff[] = { REG("cgroup", S_IRUGO, proc_cgroup_operations), #endif INF("oom_score", S_IRUGO, proc_oom_score), +#ifndef CONFIG_ANDROID REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_operations), +#else + ARD("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_inode_operations, proc_oom_adjust_operations), +#endif #ifdef CONFIG_AUDITSYSCALL REG("loginuid", S_IWUSR|S_IRUGO, proc_loginuid_operations), REG("sessionid", S_IRUGO, proc_sessionid_operations), diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 9bd8be1d235c..07376a4a3ed1 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -689,8 +689,6 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, down_read(¤t->mm->mmap_sem); ret = get_user_pages(current, current->mm, uaddr, pagecount, 1, 0, pages, NULL); - up_read(¤t->mm->mmap_sem); - if (ret < 0) goto out_free; @@ -739,6 +737,7 @@ out_pages: page_cache_release(page); } out_free: + up_read(¤t->mm->mmap_sem); kfree(pages); out_mm: mmput(mm); |