diff options
author | David S. Miller <davem@davemloft.net> | 2016-04-11 06:01:30 +0300 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2016-05-18 10:03:50 +0300 |
commit | 86f00380134811cdcf9f88af16cb5651e2e1f523 (patch) | |
tree | ee510895563c07695d36e18ead1b82e58ce5a5d2 | |
parent | 3522956c47aebf1b2e5ba62e773d5b3d8bf7d6f3 (diff) | |
download | linux-86f00380134811cdcf9f88af16cb5651e2e1f523.tar.xz |
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: Jiri Slaby <jslaby@suse.cz>
-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 fe32388ea24f..b9610051f3b2 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -1030,10 +1030,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 = @@ -1106,6 +1109,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); @@ -1147,6 +1152,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); |