]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
sctp: add the missing sock_owned_by_user check in sctp_icmp_redirect
authorXin Long <lucien.xin@gmail.com>
Wed, 18 Oct 2017 13:37:49 +0000 (21:37 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 14 Mar 2018 10:40:01 +0000 (11:40 +0100)
commitec9bb7a3bac4430a4126e1c017525072be46c83a
tree24568150ed284e579f808527ea2415074813f5ec
parent3fde705dae1cff4605eaef626f3da0ae480d5515
sctp: add the missing sock_owned_by_user check in sctp_icmp_redirect

BugLink: http://bugs.launchpad.net/bugs/1744121
[ Upstream commit 1cc276cec9ec574d41cf47dfc0f51406b6f26ab4 ]

Now sctp processes icmp redirect packet in sctp_icmp_redirect where
it calls sctp_transport_dst_check in which tp->dst can be released.

The problem is before calling sctp_transport_dst_check, it doesn't
check sock_owned_by_user, which means tp->dst could be freed while
a process is accessing it with owning the socket.

An use-after-free issue could be triggered by this.

This patch is to fix it by checking sock_owned_by_user before calling
sctp_transport_dst_check in sctp_icmp_redirect, so that it would not
release tp->dst if users still hold sock lock.

Besides, the same issue fixed in commit 45caeaa5ac0b ("dccp/tcp: fix
routing redirect race") on sctp also needs this check.

Fixes: 55be7a9c6074 ("ipv4: Add redirect support to all protocol icmp error handlers")
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/sctp/input.c