Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71719650 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Fix root mounting with no mount options"

parents 37585ba4 67ac2d68
Loading
Loading
Loading
Loading
+23 −4
Original line number Diff line number Diff line
@@ -386,9 +386,24 @@ static void __init get_fs_names(char *page)
static int __init do_mount_root(char *name, char *fs, int flags, void *data)
{
	struct super_block *s;
	int err = ksys_mount(name, "/root", fs, flags, data);
	if (err)
		return err;
	char *data_page = NULL;
	struct page *p = NULL;
	int ret;

	if (data) {
		/* do_mount() requires a full page as fifth argument */
		p = alloc_page(GFP_KERNEL);
		if (!p)
			return -ENOMEM;

		data_page = page_address(p);
		/* zero-pad. do_mount() will make sure it's terminated */
		strscpy(data_page, data, PAGE_SIZE);
	}

	ret = ksys_mount(name, "/root", fs, flags, data_page);
	if (ret)
		goto out;

	ksys_chdir("/root");
	s = current->fs->pwd.dentry->d_sb;
@@ -398,7 +413,11 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)
	       s->s_type->name,
	       sb_rdonly(s) ? " readonly" : "",
	       MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
	return 0;

out:
	if (p)
		put_page(p);
	return ret;
}

void __init mount_block_root(char *name, int flags)