Revert "kdbus: allow unix domain socket fd passing"
authorKonrad Lipinski <konrad.l@samsung.com>
Thu, 8 Sep 2016 14:47:24 +0000 (16:47 +0200)
committerKonrad Lipinski <konrad.l@samsung.com>
Fri, 9 Sep 2016 11:26:18 +0000 (13:26 +0200)
This reverts commit f2aac2074d017971dbfb49a9bbc576e03e3eb07b.

ipc/kdbus/message.c

index 4b1487a88c49fdd9c28997f35ae9643b7d168499..80960756a32994b750c5133cb5e249dffc0cfc42 100644 (file)
@@ -169,6 +169,9 @@ exit:
 
 static int kdbus_handle_check_file(struct file *file)
 {
+       struct inode *inode = file_inode(file);
+       struct socket *sock;
+
        /*
         * Don't allow file descriptors in the transport that themselves allow
         * file descriptor queueing. This will eventually be allowed once both
@@ -178,6 +181,16 @@ static int kdbus_handle_check_file(struct file *file)
        if (file->f_op == &kdbus_handle_ops)
                return -EOPNOTSUPP;
 
+       if (!S_ISSOCK(inode->i_mode))
+               return 0;
+
+       if (file->f_mode & FMODE_PATH)
+               return 0;
+
+       sock = SOCKET_I(inode);
+       if (sock->sk && sock->ops && sock->ops->family == PF_UNIX)
+               return -EOPNOTSUPP;
+
        return 0;
 }