diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-06-06 17:37:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-06 19:08:13 -0400 |
commit | 68a9a435e4efb63c49a0c0a25756e3b71a5634ed (patch) | |
tree | 798c6a7379786a26fcbbbc66fdcc298f2fe59b24 /kernel/user_namespace.c | |
parent | 24fe831c17ab8149413874f2fd4e5c8a41fcd294 (diff) |
kernel/user_namespace.c: kernel-doc/checkpatch fixes
-uid->gid
-split some function declarations
-if/then/else warning
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/user_namespace.c')
-rw-r--r-- | kernel/user_namespace.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index bf71b4b2d632..fcc02560fd6b 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c | |||
@@ -286,7 +286,7 @@ EXPORT_SYMBOL(from_kuid_munged); | |||
286 | /** | 286 | /** |
287 | * make_kgid - Map a user-namespace gid pair into a kgid. | 287 | * make_kgid - Map a user-namespace gid pair into a kgid. |
288 | * @ns: User namespace that the gid is in | 288 | * @ns: User namespace that the gid is in |
289 | * @uid: group identifier | 289 | * @gid: group identifier |
290 | * | 290 | * |
291 | * Maps a user-namespace gid pair into a kernel internal kgid, | 291 | * Maps a user-namespace gid pair into a kernel internal kgid, |
292 | * and returns that kgid. | 292 | * and returns that kgid. |
@@ -482,7 +482,8 @@ static int projid_m_show(struct seq_file *seq, void *v) | |||
482 | return 0; | 482 | return 0; |
483 | } | 483 | } |
484 | 484 | ||
485 | static void *m_start(struct seq_file *seq, loff_t *ppos, struct uid_gid_map *map) | 485 | static void *m_start(struct seq_file *seq, loff_t *ppos, |
486 | struct uid_gid_map *map) | ||
486 | { | 487 | { |
487 | struct uid_gid_extent *extent = NULL; | 488 | struct uid_gid_extent *extent = NULL; |
488 | loff_t pos = *ppos; | 489 | loff_t pos = *ppos; |
@@ -546,7 +547,8 @@ struct seq_operations proc_projid_seq_operations = { | |||
546 | .show = projid_m_show, | 547 | .show = projid_m_show, |
547 | }; | 548 | }; |
548 | 549 | ||
549 | static bool mappings_overlap(struct uid_gid_map *new_map, struct uid_gid_extent *extent) | 550 | static bool mappings_overlap(struct uid_gid_map *new_map, |
551 | struct uid_gid_extent *extent) | ||
550 | { | 552 | { |
551 | u32 upper_first, lower_first, upper_last, lower_last; | 553 | u32 upper_first, lower_first, upper_last, lower_last; |
552 | unsigned idx; | 554 | unsigned idx; |
@@ -653,7 +655,7 @@ static ssize_t map_write(struct file *file, const char __user *buf, | |||
653 | ret = -EINVAL; | 655 | ret = -EINVAL; |
654 | pos = kbuf; | 656 | pos = kbuf; |
655 | new_map.nr_extents = 0; | 657 | new_map.nr_extents = 0; |
656 | for (;pos; pos = next_line) { | 658 | for (; pos; pos = next_line) { |
657 | extent = &new_map.extent[new_map.nr_extents]; | 659 | extent = &new_map.extent[new_map.nr_extents]; |
658 | 660 | ||
659 | /* Find the end of line and ensure I don't look past it */ | 661 | /* Find the end of line and ensure I don't look past it */ |
@@ -687,13 +689,16 @@ static ssize_t map_write(struct file *file, const char __user *buf, | |||
687 | 689 | ||
688 | /* Verify we have been given valid starting values */ | 690 | /* Verify we have been given valid starting values */ |
689 | if ((extent->first == (u32) -1) || | 691 | if ((extent->first == (u32) -1) || |
690 | (extent->lower_first == (u32) -1 )) | 692 | (extent->lower_first == (u32) -1)) |
691 | goto out; | 693 | goto out; |
692 | 694 | ||
693 | /* Verify count is not zero and does not cause the extent to wrap */ | 695 | /* Verify count is not zero and does not cause the |
696 | * extent to wrap | ||
697 | */ | ||
694 | if ((extent->first + extent->count) <= extent->first) | 698 | if ((extent->first + extent->count) <= extent->first) |
695 | goto out; | 699 | goto out; |
696 | if ((extent->lower_first + extent->count) <= extent->lower_first) | 700 | if ((extent->lower_first + extent->count) <= |
701 | extent->lower_first) | ||
697 | goto out; | 702 | goto out; |
698 | 703 | ||
699 | /* Do the ranges in extent overlap any previous extents? */ | 704 | /* Do the ranges in extent overlap any previous extents? */ |
@@ -751,7 +756,8 @@ out: | |||
751 | return ret; | 756 | return ret; |
752 | } | 757 | } |
753 | 758 | ||
754 | ssize_t proc_uid_map_write(struct file *file, const char __user *buf, size_t size, loff_t *ppos) | 759 | ssize_t proc_uid_map_write(struct file *file, const char __user *buf, |
760 | size_t size, loff_t *ppos) | ||
755 | { | 761 | { |
756 | struct seq_file *seq = file->private_data; | 762 | struct seq_file *seq = file->private_data; |
757 | struct user_namespace *ns = seq->private; | 763 | struct user_namespace *ns = seq->private; |
@@ -767,7 +773,8 @@ ssize_t proc_uid_map_write(struct file *file, const char __user *buf, size_t siz | |||
767 | &ns->uid_map, &ns->parent->uid_map); | 773 | &ns->uid_map, &ns->parent->uid_map); |
768 | } | 774 | } |
769 | 775 | ||
770 | ssize_t proc_gid_map_write(struct file *file, const char __user *buf, size_t size, loff_t *ppos) | 776 | ssize_t proc_gid_map_write(struct file *file, const char __user *buf, |
777 | size_t size, loff_t *ppos) | ||
771 | { | 778 | { |
772 | struct seq_file *seq = file->private_data; | 779 | struct seq_file *seq = file->private_data; |
773 | struct user_namespace *ns = seq->private; | 780 | struct user_namespace *ns = seq->private; |
@@ -783,7 +790,8 @@ ssize_t proc_gid_map_write(struct file *file, const char __user *buf, size_t siz | |||
783 | &ns->gid_map, &ns->parent->gid_map); | 790 | &ns->gid_map, &ns->parent->gid_map); |
784 | } | 791 | } |
785 | 792 | ||
786 | ssize_t proc_projid_map_write(struct file *file, const char __user *buf, size_t size, loff_t *ppos) | 793 | ssize_t proc_projid_map_write(struct file *file, const char __user *buf, |
794 | size_t size, loff_t *ppos) | ||
787 | { | 795 | { |
788 | struct seq_file *seq = file->private_data; | 796 | struct seq_file *seq = file->private_data; |
789 | struct user_namespace *ns = seq->private; | 797 | struct user_namespace *ns = seq->private; |
@@ -800,7 +808,7 @@ ssize_t proc_projid_map_write(struct file *file, const char __user *buf, size_t | |||
800 | &ns->projid_map, &ns->parent->projid_map); | 808 | &ns->projid_map, &ns->parent->projid_map); |
801 | } | 809 | } |
802 | 810 | ||
803 | static bool new_idmap_permitted(const struct file *file, | 811 | static bool new_idmap_permitted(const struct file *file, |
804 | struct user_namespace *ns, int cap_setid, | 812 | struct user_namespace *ns, int cap_setid, |
805 | struct uid_gid_map *new_map) | 813 | struct uid_gid_map *new_map) |
806 | { | 814 | { |
@@ -811,8 +819,7 @@ static bool new_idmap_permitted(const struct file *file, | |||
811 | kuid_t uid = make_kuid(ns->parent, id); | 819 | kuid_t uid = make_kuid(ns->parent, id); |
812 | if (uid_eq(uid, file->f_cred->fsuid)) | 820 | if (uid_eq(uid, file->f_cred->fsuid)) |
813 | return true; | 821 | return true; |
814 | } | 822 | } else if (cap_setid == CAP_SETGID) { |
815 | else if (cap_setid == CAP_SETGID) { | ||
816 | kgid_t gid = make_kgid(ns->parent, id); | 823 | kgid_t gid = make_kgid(ns->parent, id); |
817 | if (gid_eq(gid, file->f_cred->fsgid)) | 824 | if (gid_eq(gid, file->f_cred->fsgid)) |
818 | return true; | 825 | return true; |