Skip to contentSkip to conversation

inet: fix NULL pointer Oops in fib(6)_rule_suppress

PATCH In review Stefan Tomanek 2 participants 2 messages Dec 8, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 inet: fix NULL pointer Oops in fib(6)_rule_suppress

---
 net/ipv4/fib_rules.c  |    5 ++++-
 net/ipv6/fib6_rules.c |    6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
net/ipv4/fib_rules.c +4 -1
index 523be38..f2e1573 100644
@@ -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
net/ipv6/fib6_rules.c +5 -1
index e275916..3fd0a57 100644
@@ -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
 	 */
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 7 lines · Stefan Tomanek
---
 net/ipv4/fib_rules.c  |    5 ++++-
 net/ipv6/fib6_rules.c |    6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

Please add a changelog, and possibly the header like :

Fixes 6ef94cfafba15 ("fib_rules: add route suppression based on ifgroup")

Thats absolutely needed to help us to backport the fix into stable kernels.

Thanks