From: Roopa Prabhu <ro...@cumulusnetworks.com> Date: Thu, 7 Apr 2016 21:28:38 -0700
> From: Roopa Prabhu <ro...@cumulusnetworks.com> > > find_outdev calls inet{,6}_fib_lookup_dev() or dev_get_by_index() to > find the output device. In case of an error, inet{,6}_fib_lookup_dev() > returns error pointer and dev_get_by_index() returns NULL. But the function > only checks for NULL and thus can end up calling dev_put on an ERR_PTR. > This patch adds an additional check for err ptr after the NULL check. > > Before: Trying to add an mpls route with no oif from user, no available > path to 10.1.1.8 and no default route: > $ip -f mpls route add 100 as 200 via inet 10.1.1.8 > [ 822.337195] BUG: unable to handle kernel NULL pointer dereference at > 00000000000003a3 ... > After patch: > $ip -f mpls route add 100 as 200 via inet 10.1.1.8 > RTNETLINK answers: Network is unreachable > > Signed-off-by: Roopa Prabhu <ro...@cumulusnetworks.com> > Reported-by: David Miller <da...@davemloft.net> Applied, thanks.