summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-22 11:13:26 +0200
committerChristoph Hellwig <hch@lst.de>2020-07-31 08:17:52 +0200
commitb873498f99c77e7b5be3aa5ffe9ca67437232fe0 (patch)
tree6164c389372c34a25a5d1015d1d004a1c0250072 /init
parent4b7ca5014cbef51cdb99fd644eae4f3773747a05 (diff)
downloadlinux-stable-b873498f99c77e7b5be3aa5ffe9ca67437232fe0.tar.gz
linux-stable-b873498f99c77e7b5be3aa5ffe9ca67437232fe0.tar.bz2
linux-stable-b873498f99c77e7b5be3aa5ffe9ca67437232fe0.zip
init: add an init_chown helper
Add a simple helper to chown with a kernel space file name and switch the early init code over to it. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'init')
-rw-r--r--init/initramfs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/init/initramfs.c b/init/initramfs.c
index 1a9159bf452f..358dcd93cb9d 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -349,14 +349,14 @@ static int __init do_name(void)
}
} else if (S_ISDIR(mode)) {
ksys_mkdir(collected, mode);
- ksys_chown(collected, uid, gid);
+ init_chown(collected, uid, gid, 0);
ksys_chmod(collected, mode);
dir_add(collected, mtime);
} else if (S_ISBLK(mode) || S_ISCHR(mode) ||
S_ISFIFO(mode) || S_ISSOCK(mode)) {
if (maybe_link() == 0) {
ksys_mknod(collected, mode, rdev);
- ksys_chown(collected, uid, gid);
+ init_chown(collected, uid, gid, 0);
ksys_chmod(collected, mode);
do_utime(collected, mtime);
}
@@ -393,7 +393,7 @@ static int __init do_symlink(void)
collected[N_ALIGN(name_len) + body_len] = '\0';
clean_path(collected, 0);
ksys_symlink(collected + N_ALIGN(name_len), collected);
- ksys_lchown(collected, uid, gid);
+ init_chown(collected, uid, gid, AT_SYMLINK_NOFOLLOW);
do_utime(collected, mtime);
state = SkipIt;
next_state = Reset;