From: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
To: netdev@vger.kernel.org
Cc: daniel.golle@gmail.com, sergei.shtylyov@cogentembedded.com
Subject: [PATCH v2] fix possible NULL pointer Oops in fib(6)_rule_suppress
Date: Sun, 17 Nov 2013 15:45:01 +0100 [thread overview]
Message-ID: <20131117144501.GC23153@zirkel.wertarbyte.de> (raw)
In-Reply-To: <5288CB1B.7050806@cogentembedded.com>
Reported-by: Daniel Golle <daniel.golle@gmail.com>
Tested-by: Daniel Golle <daniel.golle@gmail.com>
Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
---
net/ipv4/fib_rules.c | 5 ++++-
net/ipv6/fib6_rules.c | 6 +++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 523be38..f2e1573 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -104,7 +104,10 @@ errout:
static bool fib4_rule_suppress(struct fib_rule *rule, struct fib_lookup_arg *arg)
{
struct fib_result *result = (struct fib_result *) arg->result;
- struct net_device *dev = result->fi->fib_dev;
+ struct net_device *dev = NULL;
+
+ if (result->fi)
+ dev = result->fi->fib_dev;
/* do not accept result if the route does
* not meet the required prefix length
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index e275916..3fd0a57 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -122,7 +122,11 @@ out:
static bool fib6_rule_suppress(struct fib_rule *rule, struct fib_lookup_arg *arg)
{
struct rt6_info *rt = (struct rt6_info *) arg->result;
- struct net_device *dev = rt->rt6i_idev->dev;
+ struct net_device *dev = NULL;
+
+ if (rt->rt6i_idev)
+ dev = rt->rt6i_idev->dev;
+
/* do not accept result if the route does
* not meet the required prefix length
*/
--
1.7.10.4
next prev parent reply other threads:[~2013-11-17 14:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-17 11:14 [PATCH] fix NULL pointer Oops in fib(6)_rule_suppress Stefan Tomanek
2013-11-17 13:56 ` Sergei Shtylyov
2013-11-17 14:45 ` Stefan Tomanek [this message]
2013-11-18 20:51 ` [PATCH v2] fix possible " David Miller
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=20131117144501.GC23153@zirkel.wertarbyte.de \
--to=stefan.tomanek@wertarbyte.de \
--cc=daniel.golle@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.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).