diff mbox

netrom: info leak in ->getname()

Message ID 20130423062251.GB15893@elgon.mountain
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter April 23, 2013, 6:22 a.m. UTC
The sockaddr_ax25 struct has a 3 byte hole between ->sax25_call and
->sax25_ndigis.  I've added a memset to avoid leaking uninitialized
stack data to userspace.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Ralf Baechle April 23, 2013, 8:52 a.m. UTC | #1
On Tue, Apr 23, 2013 at 09:22:51AM +0300, Dan Carpenter wrote:

> The sockaddr_ax25 struct has a 3 byte hole between ->sax25_call and
> ->sax25_ndigis.  I've added a memset to avoid leaking uninitialized
> stack data to userspace.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
> index 103bd70..ec0c80f 100644
> --- a/net/netrom/af_netrom.c
> +++ b/net/netrom/af_netrom.c
> @@ -834,6 +834,8 @@ static int nr_getname(struct socket *sock, struct sockaddr *uaddr,
>  	struct sock *sk = sock->sk;
>  	struct nr_sock *nr = nr_sk(sk);
>  
> +	memset(&sax->fsa_ax25, 0, sizeof(struct sockaddr_ax25));
> +
>  	lock_sock(sk);
>  	if (peer != 0) {
>  		if (sk->sk_state != TCP_ESTABLISHED) {

Good catch.

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller April 25, 2013, 5:48 a.m. UTC | #2
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Tue, 23 Apr 2013 09:22:51 +0300

> The sockaddr_ax25 struct has a 3 byte hole between ->sax25_call and
> ->sax25_ndigis.  I've added a memset to avoid leaking uninitialized
> stack data to userspace.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Cathryn Mataga July 6, 2013, 6:53 a.m. UTC | #3
"Sorry! This site is experiencing technical difficulties."  It says.  I 
think maybe it needs a kick.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 103bd70..ec0c80f 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -834,6 +834,8 @@  static int nr_getname(struct socket *sock, struct sockaddr *uaddr,
 	struct sock *sk = sock->sk;
 	struct nr_sock *nr = nr_sk(sk);
 
+	memset(&sax->fsa_ax25, 0, sizeof(struct sockaddr_ax25));
+
 	lock_sock(sk);
 	if (peer != 0) {
 		if (sk->sk_state != TCP_ESTABLISHED) {