diff options
author | David S. Miller <davem@davemloft.net> | 2016-04-10 23:01:30 -0400 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-07-10 23:07:20 -0400 |
commit | 1ea4df4a2642ba2856a70e4530ae922f0c8e672e (patch) | |
tree | f18bda2cfcb8482a9df605701c641caf10fbb070 /net | |
parent | 51319f40e513500085f25ae42ace31b8bc4bcfc2 (diff) |
decnet: Do not build routes to devices without decnet private data.
[ Upstream commit a36a0d4008488fa545c74445d69eaf56377d5d4e ]
In particular, make sure we check for decnet private presence
for loopback devices.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/decnet/dn_route.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 03227ffd19ce..76d3bf70c31a 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -1036,10 +1036,13 @@ source_ok: if (!fld.daddr) { fld.daddr = fld.saddr; - err = -EADDRNOTAVAIL; if (dev_out) dev_put(dev_out); + err = -EINVAL; dev_out = init_net.loopback_dev; + if (!dev_out->dn_ptr) + goto out; + err = -EADDRNOTAVAIL; dev_hold(dev_out); if (!fld.daddr) { fld.daddr = @@ -1112,6 +1115,8 @@ source_ok: if (dev_out == NULL) goto out; dn_db = rcu_dereference_raw(dev_out->dn_ptr); + if (!dn_db) + goto e_inval; /* Possible improvement - check all devices for local addr */ if (dn_dev_islocal(dev_out, fld.daddr)) { dev_put(dev_out); @@ -1153,6 +1158,8 @@ select_source: dev_put(dev_out); dev_out = init_net.loopback_dev; dev_hold(dev_out); + if (!dev_out->dn_ptr) + goto e_inval; fld.flowidn_oif = dev_out->ifindex; if (res.fi) dn_fib_info_put(res.fi); |