[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20160408.124353.1354015446819079138.davem@davemloft.net>
Date: Fri, 08 Apr 2016 12:43:53 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: roopa@...ulusnetworks.com
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net] mpls: find_outdev: check for err ptr in addition
to NULL check
From: Roopa Prabhu <roopa@...ulusnetworks.com>
Date: Thu, 7 Apr 2016 21:28:38 -0700
> From: Roopa Prabhu <roopa@...ulusnetworks.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 <roopa@...ulusnetworks.com>
> Reported-by: David Miller <davem@...emloft.net>
Applied, thanks.
Powered by blists - more mailing lists