netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix NULL pointer Oops in fib(6)_rule_suppress
@ 2013-11-17 11:14 Stefan Tomanek
  2013-11-17 13:56 ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Tomanek @ 2013-11-17 11:14 UTC (permalink / raw)
  To: netdev; +Cc: Daniel Golle

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  |    4 +++-
 net/ipv6/fib6_rules.c |    5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 523be38..4e1c1e5 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -104,7 +104,9 @@ 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..43e45b5 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -122,7 +122,10 @@ 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] fix NULL pointer Oops in fib(6)_rule_suppress
  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   ` [PATCH v2] fix possible " Stefan Tomanek
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2013-11-17 13:56 UTC (permalink / raw)
  To: Stefan Tomanek, netdev; +Cc: Daniel Golle

Hello.

On 17-11-2013 15:14, 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  |    4 +++-
>   net/ipv6/fib6_rules.c |    5 ++++-
>   2 files changed, 7 insertions(+), 2 deletions(-)

> diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
> index 523be38..4e1c1e5 100644
> --- a/net/ipv4/fib_rules.c
> +++ b/net/ipv4/fib_rules.c
> @@ -104,7 +104,9 @@ 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;

    Please leave empty line after declarations, like it was before your patch.

> +	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..43e45b5 100644
> --- a/net/ipv6/fib6_rules.c
> +++ b/net/ipv6/fib6_rules.c
> @@ -122,7 +122,10 @@ 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;

    Same here.

> +	if (rt->rt6i_idev)
> +		dev = rt->rt6i_idev->dev;
> +

WBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] fix possible NULL pointer Oops in fib(6)_rule_suppress
  2013-11-17 13:56 ` Sergei Shtylyov
@ 2013-11-17 14:45   ` Stefan Tomanek
  2013-11-18 20:51     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Tomanek @ 2013-11-17 14:45 UTC (permalink / raw)
  To: netdev; +Cc: 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 v2] fix possible NULL pointer Oops in fib(6)_rule_suppress
  2013-11-17 14:45   ` [PATCH v2] fix possible " Stefan Tomanek
@ 2013-11-18 20:51     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-11-18 20:51 UTC (permalink / raw)
  To: stefan.tomanek; +Cc: netdev, daniel.golle, sergei.shtylyov

From: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
Date: Sun, 17 Nov 2013 15:45:01 +0100

> 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>

Please us an appropriate subsystem prefix in your Subject lines, otherwise
the commit message header is less useful for others scanning the commit
log.

"inet: " would work well in this case.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-18 20:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [PATCH v2] fix possible " Stefan Tomanek
2013-11-18 20:51     ` David Miller

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).