From: David Miller <davem@davemloft.net>
To: roopa@cumulusnetworks.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] mpls: find_outdev: check for err ptr in addition to NULL check
Date: Fri, 08 Apr 2016 12:43:53 -0400 (EDT) [thread overview]
Message-ID: <20160408.124353.1354015446819079138.davem@davemloft.net> (raw)
In-Reply-To: <1460089718-25788-1-git-send-email-roopa@cumulusnetworks.com>
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Thu, 7 Apr 2016 21:28:38 -0700
> From: Roopa Prabhu <roopa@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 <roopa@cumulusnetworks.com>
> Reported-by: David Miller <davem@davemloft.net>
Applied, thanks.
prev parent reply other threads:[~2016-04-08 16:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-08 4:28 [PATCH net] mpls: find_outdev: check for err ptr in addition to NULL check Roopa Prabhu
2016-04-08 16:43 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160408.124353.1354015446819079138.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).