[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1320201017.4728.31.camel@edumazet-laptop>
Date: Wed, 02 Nov 2011 03:30:17 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Dave Jones <davej@...hat.com>
Cc: netdev@...r.kernel.org, Matthew Daley <mattjd@...il.com>
Subject: Re: [v2] Fix NULL dereference in x25_recvmsg
Le mardi 01 novembre 2011 à 22:26 -0400, Dave Jones a écrit :
> commit cb101ed2 in 3.0 introduced a bug in x25_recvmsg()
> When passed bogus junk from userspace, x25->neighbour can be NULL,
> as shown in this oops..
>
...
> Signed-off-by: Dave Jones <davej@...hat.com>
>
> diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
> index 5f03e4e..3e16c6a 100644
> --- a/net/x25/af_x25.c
> +++ b/net/x25/af_x25.c
> @@ -1261,14 +1261,19 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
> struct x25_sock *x25 = x25_sk(sk);
> struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)msg->msg_name;
> size_t copied;
> - int qbit, header_len = x25->neighbour->extended ?
> - X25_EXT_MIN_LEN : X25_STD_MIN_LEN;
> -
> + int qbit, header_len;
> struct sk_buff *skb;
> unsigned char *asmptr;
> int rc = -ENOTCONN;
>
> lock_sock(sk);
> +
> + if (x25->neighbour == NULL)
> + goto out;
> +
> + header_len = x25->neighbour->extended ?
> + X25_EXT_MIN_LEN : X25_STD_MIN_LEN;
> +
> /*
> * This works for seqpacket too. The receiver has ordered the queue for
> * us! We do one quick check first though
Acked-by: Eric Dumazet <eric.dumazet@...il.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists