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

Commit 326be7b4 authored by Al Viro's avatar Al Viro
Browse files

Allow passing O_PATH descriptors via SCM_RIGHTS datagrams



Just need to make sure that AF_UNIX garbage collector won't
confuse O_PATHed socket on filesystem for real AF_UNIX opened
socket.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 65cfc672
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -305,6 +305,8 @@ struct file *fget_raw(unsigned int fd)
	return file;
}

EXPORT_SYMBOL(fget_raw);

/*
 * Lightweight file lookup - no refcnt increment if fd table isn't shared.
 *
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)
		int fd = fdp[i];
		struct file *file;

		if (fd < 0 || !(file = fget(fd)))
		if (fd < 0 || !(file = fget_raw(fd)))
			return -EBADF;
		*fpp++ = file;
		fpl->count++;
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ struct sock *unix_get_socket(struct file *filp)
	/*
	 *	Socket ?
	 */
	if (S_ISSOCK(inode->i_mode)) {
	if (S_ISSOCK(inode->i_mode) && !(filp->f_mode & FMODE_PATH)) {
		struct socket *sock = SOCKET_I(inode);
		struct sock *s = sock->sk;