Unverified Commit 1afcbbe5 authored by Christian Brauner's avatar Christian Brauner
Browse files
parent 981bec8f
Loading
Loading
Loading
Loading
+5 −24
Original line number Diff line number Diff line
@@ -470,9 +470,9 @@ SYSCALL_DEFINE2(memfd_create,
		const char __user *, uname,
		unsigned int, flags)
{
	struct file *file;
	int fd, error;
	char *name;
	char *name __free(kfree) = NULL;
	unsigned int fd_flags;
	int error;

	error = sanitize_flags(&flags);
	if (error < 0)
@@ -482,25 +482,6 @@ SYSCALL_DEFINE2(memfd_create,
	if (IS_ERR(name))
		return PTR_ERR(name);

	fd = get_unused_fd_flags((flags & MFD_CLOEXEC) ? O_CLOEXEC : 0);
	if (fd < 0) {
		error = fd;
		goto err_free_name;
	}

	file = alloc_file(name, flags);
	if (IS_ERR(file)) {
		error = PTR_ERR(file);
		goto err_free_fd;
	}

	fd_install(fd, file);
	kfree(name);
	return fd;

err_free_fd:
	put_unused_fd(fd);
err_free_name:
	kfree(name);
	return error;
	fd_flags = (flags & MFD_CLOEXEC) ? O_CLOEXEC : 0;
	return FD_ADD(fd_flags, alloc_file(name, flags));
}