Commit 86f00380 authored by David S. Miller's avatar David S. Miller Committed by Jiri Slaby

decnet: Do not build routes to devices without decnet private data.

[ Upstream commit a36a0d40 ]

In particular, make sure we check for decnet private presence
for loopback devices.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 3522956c
...@@ -1030,10 +1030,13 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowidn *o ...@@ -1030,10 +1030,13 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowidn *o
if (!fld.daddr) { if (!fld.daddr) {
fld.daddr = fld.saddr; fld.daddr = fld.saddr;
err = -EADDRNOTAVAIL;
if (dev_out) if (dev_out)
dev_put(dev_out); dev_put(dev_out);
err = -EINVAL;
dev_out = init_net.loopback_dev; dev_out = init_net.loopback_dev;
if (!dev_out->dn_ptr)
goto out;
err = -EADDRNOTAVAIL;
dev_hold(dev_out); dev_hold(dev_out);
if (!fld.daddr) { if (!fld.daddr) {
fld.daddr = fld.daddr =
...@@ -1106,6 +1109,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowidn *o ...@@ -1106,6 +1109,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowidn *o
if (dev_out == NULL) if (dev_out == NULL)
goto out; goto out;
dn_db = rcu_dereference_raw(dev_out->dn_ptr); dn_db = rcu_dereference_raw(dev_out->dn_ptr);
if (!dn_db)
goto e_inval;
/* Possible improvement - check all devices for local addr */ /* Possible improvement - check all devices for local addr */
if (dn_dev_islocal(dev_out, fld.daddr)) { if (dn_dev_islocal(dev_out, fld.daddr)) {
dev_put(dev_out); dev_put(dev_out);
...@@ -1147,6 +1152,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowidn *o ...@@ -1147,6 +1152,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowidn *o
dev_put(dev_out); dev_put(dev_out);
dev_out = init_net.loopback_dev; dev_out = init_net.loopback_dev;
dev_hold(dev_out); dev_hold(dev_out);
if (!dev_out->dn_ptr)
goto e_inval;
fld.flowidn_oif = dev_out->ifindex; fld.flowidn_oif = dev_out->ifindex;
if (res.fi) if (res.fi)
dn_fib_info_put(res.fi); dn_fib_info_put(res.fi);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment