]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
ipv4/route: fail early when inet dev is missing
authorPaolo Abeni <pabeni@redhat.com>
Wed, 6 Mar 2019 09:42:53 +0000 (10:42 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Wed, 20 Mar 2019 19:06:15 +0000 (14:06 -0500)
commit30e4e7cbabd4b6bb140f08d4f61f947f197ca46c
treecb262a4ffda585701a2b8222b0af0bf18aae98e7
parentc9c7bcae649568c6c7870c8354b4106662bb91c5
ipv4/route: fail early when inet dev is missing

BugLink: https://bugs.launchpad.net/bugs/1821074
[ Upstream commit 22c74764aa2943ecdf9f07c900d8a9c8ba6c9265 ]

If a non local multicast packet reaches ip_route_input_rcu() while
the ingress device IPv4 private data (in_dev) is NULL, we end up
doing a NULL pointer dereference in IN_DEV_MFORWARD().

Since the later call to ip_route_input_mc() is going to fail if
!in_dev, we can fail early in such scenario and avoid the dangerous
code path.

v1 -> v2:
 - clarified the commit message, no code changes

Reported-by: Tianhao Zhao <tizhao@redhat.com>
Fixes: e58e41596811 ("net: Enable support for VRF with ipv4 multicast")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
net/ipv4/route.c