netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tipc: validate length of sockaddr in connect() for dgram/rdm
@ 2015-03-23 19:30 Sasha Levin
  2015-03-24  9:11 ` Ying Xue
  2015-03-24 16:57 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Sasha Levin @ 2015-03-23 19:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: erik.hugne, ying.xue, jon.maloy, davem, Sasha Levin,
	Allan Stephens, open list:TIPC NETWORK LAYER,
	open list:TIPC NETWORK LAYER

Commit f2f8036 ("tipc: add support for connect() on dgram/rdm sockets")
hasn't validated user input length for the sockaddr structure which allows
a user to overwrite kernel memory with arbitrary input.

Fixes: f2f8036 ("tipc: add support for connect() on dgram/rdm sockets")
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 net/tipc/socket.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 73c2f51..986dc96 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1852,6 +1852,8 @@ static int tipc_connect(struct socket *sock, struct sockaddr *dest,
 		if (dst->family == AF_UNSPEC) {
 			memset(&tsk->remote, 0, sizeof(struct sockaddr_tipc));
 			tsk->connected = 0;
+		} else if (destlen != sizeof(struct sockaddr_tipc)) {
+			res = -EINVAL;
 		} else {
 			memcpy(&tsk->remote, dest, destlen);
 			tsk->connected = 1;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tipc: validate length of sockaddr in connect() for dgram/rdm
  2015-03-23 19:30 [PATCH] tipc: validate length of sockaddr in connect() for dgram/rdm Sasha Levin
@ 2015-03-24  9:11 ` Ying Xue
  2015-03-24 16:57 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Ying Xue @ 2015-03-24  9:11 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel
  Cc: erik.hugne, jon.maloy, davem, Allan Stephens, TIPC NETWORK LAYER

On 03/24/2015 03:30 AM, Sasha Levin wrote:
> Commit f2f8036 ("tipc: add support for connect() on dgram/rdm sockets")
> hasn't validated user input length for the sockaddr structure which allows
> a user to overwrite kernel memory with arbitrary input.
> 
> Fixes: f2f8036 ("tipc: add support for connect() on dgram/rdm sockets")
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Acked-by: Ying Xue <ying.xue@windriver.com>

> ---
>  net/tipc/socket.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/tipc/socket.c b/net/tipc/socket.c
> index 73c2f51..986dc96 100644
> --- a/net/tipc/socket.c
> +++ b/net/tipc/socket.c
> @@ -1852,6 +1852,8 @@ static int tipc_connect(struct socket *sock, struct sockaddr *dest,
>  		if (dst->family == AF_UNSPEC) {
>  			memset(&tsk->remote, 0, sizeof(struct sockaddr_tipc));
>  			tsk->connected = 0;
> +		} else if (destlen != sizeof(struct sockaddr_tipc)) {
> +			res = -EINVAL;
>  		} else {
>  			memcpy(&tsk->remote, dest, destlen);
>  			tsk->connected = 1;
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tipc: validate length of sockaddr in connect() for dgram/rdm
  2015-03-23 19:30 [PATCH] tipc: validate length of sockaddr in connect() for dgram/rdm Sasha Levin
  2015-03-24  9:11 ` Ying Xue
@ 2015-03-24 16:57 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-03-24 16:57 UTC (permalink / raw)
  To: sasha.levin
  Cc: linux-kernel, erik.hugne, ying.xue, jon.maloy, allan.stephens,
	netdev, tipc-discussion

From: Sasha Levin <sasha.levin@oracle.com>
Date: Mon, 23 Mar 2015 15:30:00 -0400

> Commit f2f8036 ("tipc: add support for connect() on dgram/rdm sockets")
> hasn't validated user input length for the sockaddr structure which allows
> a user to overwrite kernel memory with arbitrary input.
> 
> Fixes: f2f8036 ("tipc: add support for connect() on dgram/rdm sockets")
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-24 16:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-23 19:30 [PATCH] tipc: validate length of sockaddr in connect() for dgram/rdm Sasha Levin
2015-03-24  9:11 ` Ying Xue
2015-03-24 16:57 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).