[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQLX3U4uSASVeha54oZsgi6DhNuYSXyW6=uKuf=ijC5vdQ@mail.gmail.com>
Date: Thu, 21 Nov 2019 12:15:40 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: John Fastabend <john.fastabend@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Network Development <netdev@...r.kernel.org>,
Dan Carpenter <dan.carpenter@...cle.com>,
Daniel Borkmann <daniel@...earbox.net>
Subject: Re: [net PATCH] bpf: skmsg, fix potential psock NULL pointer dereference
On Thu, Nov 21, 2019 at 8:28 AM John Fastabend <john.fastabend@...il.com> wrote:
>
> Report from Dan Carpenter,
>
> net/core/skmsg.c:792 sk_psock_write_space()
> error: we previously assumed 'psock' could be null (see line 790)
>
> net/core/skmsg.c
> 789 psock = sk_psock(sk);
> 790 if (likely(psock && sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)))
> Check for NULL
> 791 schedule_work(&psock->work);
> 792 write_space = psock->saved_write_space;
> ^^^^^^^^^^^^^^^^^^^^^^^^
> 793 rcu_read_unlock();
> 794 write_space(sk);
>
> Ensure psock dereference on line 792 only occurs if psock is not null.
>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface")
> Signed-off-by: John Fastabend <john.fastabend@...il.com>
lgtm.
John, do you feel strongly about it going to net tree asap?
Can it go to net-next ? The merge window is right around the corner.
Powered by blists - more mailing lists