net: fix decnet rtnexthop parsing
authorVegard Nossum <vegard.nossum@oracle.com>
Tue, 5 Jul 2016 19:12:53 +0000 (21:12 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 5 Jul 2016 21:08:47 +0000 (14:08 -0700)
commitab58298cf459fcd4f588a401d36abf0bd2215b51
tree58c77416b58a2b50ff681d1e3fde2444d17fdc98
parentf5d6516120ee5c777fb7b1ba9d39031881ad511b
net: fix decnet rtnexthop parsing

dn_fib_count_nhs() could enter an infinite loop if nhp->rtnh_len == 0
(i.e. if userspace passes a malformed netlink message).

Let's use the helpers from net/nexthop.h which take care of all this
stuff. We can do exactly the same as e.g. fib_count_nexthops() and
fib_get_nhs() from net/ipv4/fib_semantics.c.

This fixes the softlockup for me.

Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/decnet/dn_fib.c