aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorErik Hugne <erik.hugne@ericsson.com>2014-12-03 08:44:44 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-09 13:30:13 -0500
commit88b17b6a22673715348cb6c99a00ff2a0a2a9f9e (patch)
tree132d26259412e01737b991b0b9725b13bd0e5fc1 /net/tipc/socket.c
parent11e6c65a4cb421436a3b533096701c63762db3aa (diff)
tipc: drop tx side permission checks
Part of the old remote management feature is a piece of code that checked permissions on the local system to see if a certain operation was permitted, and if so pass the command to a remote node. This serves no purpose after the removal of remote management with commit 5902385a2440 ("tipc: obsolete the remote management feature") so we remove it. Signed-off-by: Erik Hugne <erik.hugne@ericsson.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 9658d9b63876..4731cad99d1c 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -827,39 +827,6 @@ exit:
827 return TIPC_OK; 827 return TIPC_OK;
828} 828}
829 829
830/**
831 * dest_name_check - verify user is permitted to send to specified port name
832 * @dest: destination address
833 * @m: descriptor for message to be sent
834 *
835 * Prevents restricted configuration commands from being issued by
836 * unauthorized users.
837 *
838 * Returns 0 if permission is granted, otherwise errno
839 */
840static int dest_name_check(struct sockaddr_tipc *dest, struct msghdr *m)
841{
842 struct tipc_cfg_msg_hdr hdr;
843
844 if (unlikely(dest->addrtype == TIPC_ADDR_ID))
845 return 0;
846 if (likely(dest->addr.name.name.type >= TIPC_RESERVED_TYPES))
847 return 0;
848 if (likely(dest->addr.name.name.type == TIPC_TOP_SRV))
849 return 0;
850 if (likely(dest->addr.name.name.type != TIPC_CFG_SRV))
851 return -EACCES;
852
853 if (!m->msg_iovlen || (m->msg_iov[0].iov_len < sizeof(hdr)))
854 return -EMSGSIZE;
855 if (copy_from_user(&hdr, m->msg_iov[0].iov_base, sizeof(hdr)))
856 return -EFAULT;
857 if ((ntohs(hdr.tcm_type) & 0xC000) && (!capable(CAP_NET_ADMIN)))
858 return -EACCES;
859
860 return 0;
861}
862
863static int tipc_wait_for_sndmsg(struct socket *sock, long *timeo_p) 830static int tipc_wait_for_sndmsg(struct socket *sock, long *timeo_p)
864{ 831{
865 struct sock *sk = sock->sk; 832 struct sock *sk = sock->sk;
@@ -912,7 +879,7 @@ static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock,
912 struct tipc_name_seq *seq = &dest->addr.nameseq; 879 struct tipc_name_seq *seq = &dest->addr.nameseq;
913 u32 mtu; 880 u32 mtu;
914 long timeo; 881 long timeo;
915 int rc = -EINVAL; 882 int rc;
916 883
917 if (unlikely(!dest)) 884 if (unlikely(!dest))
918 return -EDESTADDRREQ; 885 return -EDESTADDRREQ;
@@ -945,9 +912,6 @@ static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock,
945 tsk->conn_instance = dest->addr.name.name.instance; 912 tsk->conn_instance = dest->addr.name.name.instance;
946 } 913 }
947 } 914 }
948 rc = dest_name_check(dest, m);
949 if (rc)
950 goto exit;
951 915
952 timeo = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT); 916 timeo = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT);
953 917