diff options
Diffstat (limited to 'net/tipc/socket.c')
| -rw-r--r-- | net/tipc/socket.c | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 29d94d53198d..e1c791798ba1 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -535,6 +535,9 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,  	if (unlikely((m->msg_namelen < sizeof(*dest)) ||  		     (dest->family != AF_TIPC)))  		return -EINVAL; +	if ((total_len > TIPC_MAX_USER_MSG_SIZE) || +	    (m->msg_iovlen > (unsigned)INT_MAX)) +		return -EMSGSIZE;  	if (iocb)  		lock_sock(sk); @@ -640,6 +643,10 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,  	if (unlikely(dest))  		return send_msg(iocb, sock, m, total_len); +	if ((total_len > TIPC_MAX_USER_MSG_SIZE) || +	    (m->msg_iovlen > (unsigned)INT_MAX)) +		return -EMSGSIZE; +  	if (iocb)  		lock_sock(sk); @@ -723,6 +730,12 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,  		goto exit;  	} +	if ((total_len > (unsigned)INT_MAX) || +	    (m->msg_iovlen > (unsigned)INT_MAX)) { +		res = -EMSGSIZE; +		goto exit; +	} +  	/*  	 * Send each iovec entry using one or more messages  	 * | 
