* [PATCH] inet: fix NULL pointer Oops in fib(6)_rule_suppress
@ 2013-12-08 19:18 Stefan Tomanek
2013-12-08 19:28 ` Eric Dumazet
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Tomanek @ 2013-12-08 19:18 UTC (permalink / raw)
To: netdev; +Cc: davem, daniel.golle, sergei.shtylyov
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] inet: fix NULL pointer Oops in fib(6)_rule_suppress
2013-12-08 19:18 Stefan Tomanek
@ 2013-12-08 19:28 ` Eric Dumazet
0 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2013-12-08 19:28 UTC (permalink / raw)
To: Stefan Tomanek; +Cc: netdev, davem, daniel.golle, sergei.shtylyov
On Sun, 2013-12-08 at 20:18 +0100, Stefan Tomanek wrote:
> 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(-)
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] inet: fix NULL pointer Oops in fib(6)_rule_suppress
@ 2013-12-10 22:21 Stefan Tomanek
2013-12-10 22:56 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Tomanek @ 2013-12-10 22:21 UTC (permalink / raw)
To: netdev; +Cc: davem, daniel.golle, sergei.shtylyov, eric.dumazet
This changes ensures that the routing entry investigated by the suppress
function actually does point to a device struct before following that pointer,
fixing a possible kernel oops situation when verifying the interface group
associated with a routing table entry.
According to Daniel Golle, this Oops can be triggered by a user process trying
to establish an outgoing IPv6 connection while having no real IPv6 connectivity
set up (only autoassigned link-local addresses).
Fixes: 6ef94cfafba15 ("fib_rules: add route suppression based on ifgroup")
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] inet: fix NULL pointer Oops in fib(6)_rule_suppress
2013-12-10 22:21 [PATCH] inet: fix NULL pointer Oops in fib(6)_rule_suppress Stefan Tomanek
@ 2013-12-10 22:56 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-12-10 22:56 UTC (permalink / raw)
To: stefan.tomanek; +Cc: netdev, daniel.golle, sergei.shtylyov, eric.dumazet
From: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
Date: Tue, 10 Dec 2013 23:21:25 +0100
> This changes ensures that the routing entry investigated by the suppress
> function actually does point to a device struct before following that pointer,
> fixing a possible kernel oops situation when verifying the interface group
> associated with a routing table entry.
>
> According to Daniel Golle, this Oops can be triggered by a user process trying
> to establish an outgoing IPv6 connection while having no real IPv6 connectivity
> set up (only autoassigned link-local addresses).
>
> Fixes: 6ef94cfafba15 ("fib_rules: add route suppression based on ifgroup")
>
> 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>
Looks good, applied and queued up for -stable, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-10 22:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 22:21 [PATCH] inet: fix NULL pointer Oops in fib(6)_rule_suppress Stefan Tomanek
2013-12-10 22:56 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2013-12-08 19:18 Stefan Tomanek
2013-12-08 19:28 ` Eric Dumazet
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).