]> git.baikalelectronics.ru Git - 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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Mar 2019 18:23:18 +0000 (10:23 -0800)
commit17f0d40a8f5b0c261098f335376c6ecde85f5329
tree44693948394b290d37255d46367355fef53eb8bd
parent0b1f09b6dc3f405ab4c930c08da0fb14e9c23f09
ipv4/route: fail early when inet dev is missing

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: 00ba4bc64bbc ("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>
net/ipv4/route.c