[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLWOkR3odzkdoYbXCwNEkiQsM7MeONX5GVd0OMJZSBOYA@mail.gmail.com>
Date: Wed, 16 Dec 2015 13:07:30 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Cong Wang <cwang@...pensource.com>
Cc: Dmitry Vyukov <dvyukov@...gle.com>,
Willem de Bruijn <willemb@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Mel Gorman <mgorman@...hsingularity.net>,
Craig Gallek <kraig@...gle.com>,
Ying Xue <ying.xue@...driver.com>,
Hannes Frederic Sowa <hannes@...essinduktion.org>,
Edward Jee <edjee@...gle.com>,
Julia Lawall <julia.lawall@...6.fr>,
netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
syzkaller <syzkaller@...glegroups.com>,
Kostya Serebryany <kcc@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Sasha Levin <sasha.levin@...cle.com>
Subject: Re: net: heap-out-of-bounds in sock_setsockopt
On Wed, Dec 16, 2015 at 12:22 PM, Cong Wang <cwang@...pensource.com> wrote:
> Hmm, we should exclude the raw socket case, something like the
> following, but I am not sure if the check is too strict or not, also
> not sure if we should return an error for this raw socket case.
>
> diff --git a/net/core/sock.c b/net/core/sock.c
> index 765be83..c26e80a 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -872,7 +872,7 @@ int sock_setsockopt(struct socket *sock, int
> level, int optname,
>
> if (val & SOF_TIMESTAMPING_OPT_ID &&
> !(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)) {
> - if (sk->sk_protocol == IPPROTO_TCP) {
> + if (sk->sk_protocol == IPPROTO_TCP &&
> sk->sk_type == SOCK_STREAM) {
> if (sk->sk_state != TCP_ESTABLISHED) {
> ret = -EINVAL;
> break;
This looks right, please post this officially ;)
tcp_sk(sk) only works for TCP sockets , and the test must include
sk->sk_type == SOCK_STREAM
--
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