All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: ipv4: Fix NULL pointer dereference in route lookup
@ 2019-03-01 13:38 Ido Schimmel
  2019-03-01 14:36 ` wenxu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ido Schimmel @ 2019-03-01 13:38 UTC (permalink / raw)
  To: netdev; +Cc: davem, dsahern, mlxsw, Ido Schimmel, wenxu

When calculating the multipath hash for input routes the flow info is
not available and therefore should not be used.

Fixes: 24ba14406c5c ("route: Add multipath_hash in flowi_common to make user-define hash")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Cc: wenxu <wenxu@ucloud.cn>
---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 7cf4c8305071..e3ac458b5d8b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1820,7 +1820,7 @@ static void ip_multipath_l3_keys(const struct sk_buff *skb,
 int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4,
 		       const struct sk_buff *skb, struct flow_keys *flkeys)
 {
-	u32 multipath_hash = fl4->flowi4_multipath_hash;
+	u32 multipath_hash = fl4 ? fl4->flowi4_multipath_hash : 0;
 	struct flow_keys hash_keys;
 	u32 mhash;
 
-- 
2.20.1


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

* Re: [PATCH net-next] net: ipv4: Fix NULL pointer dereference in route lookup
  2019-03-01 13:38 [PATCH net-next] net: ipv4: Fix NULL pointer dereference in route lookup Ido Schimmel
@ 2019-03-01 14:36 ` wenxu
  2019-03-01 18:32 ` Nikolay Aleksandrov
  2019-03-02  8:42 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: wenxu @ 2019-03-01 14:36 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: davem, dsahern, mlxsw

On 2019/3/1 下午9:38, Ido Schimmel wrote:
> When calculating the multipath hash for input routes the flow info is
> not available and therefore should not be used.
>
> Fixes: 24ba14406c5c ("route: Add multipath_hash in flowi_common to make user-define hash")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Cc: wenxu <wenxu@ucloud.cn>
> ---
>  net/ipv4/route.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 7cf4c8305071..e3ac458b5d8b 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1820,7 +1820,7 @@ static void ip_multipath_l3_keys(const struct sk_buff *skb,
>  int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4,
>  		       const struct sk_buff *skb, struct flow_keys *flkeys)
>  {
> -	u32 multipath_hash = fl4->flowi4_multipath_hash;
> +	u32 multipath_hash = fl4 ? fl4->flowi4_multipath_hash : 0;
>  	struct flow_keys hash_keys;
>  	u32 mhash;
>  

Acked-by: wenxu <wenxu@ucloud.cn>


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

* Re: [PATCH net-next] net: ipv4: Fix NULL pointer dereference in route lookup
  2019-03-01 13:38 [PATCH net-next] net: ipv4: Fix NULL pointer dereference in route lookup Ido Schimmel
  2019-03-01 14:36 ` wenxu
@ 2019-03-01 18:32 ` Nikolay Aleksandrov
  2019-03-02  8:42 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Nikolay Aleksandrov @ 2019-03-01 18:32 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: davem, dsahern, mlxsw, wenxu

On 01/03/2019 15:38, Ido Schimmel wrote:
> When calculating the multipath hash for input routes the flow info is
> not available and therefore should not be used.
> 
> Fixes: 24ba14406c5c ("route: Add multipath_hash in flowi_common to make user-define hash")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Cc: wenxu <wenxu@ucloud.cn>
> ---
>  net/ipv4/route.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 7cf4c8305071..e3ac458b5d8b 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -1820,7 +1820,7 @@ static void ip_multipath_l3_keys(const struct sk_buff *skb,
>  int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4,
>  		       const struct sk_buff *skb, struct flow_keys *flkeys)
>  {
> -	u32 multipath_hash = fl4->flowi4_multipath_hash;
> +	u32 multipath_hash = fl4 ? fl4->flowi4_multipath_hash : 0;
>  	struct flow_keys hash_keys;
>  	u32 mhash;
>  
> 

indeed, missed it during review, thanks!
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>


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

* Re: [PATCH net-next] net: ipv4: Fix NULL pointer dereference in route lookup
  2019-03-01 13:38 [PATCH net-next] net: ipv4: Fix NULL pointer dereference in route lookup Ido Schimmel
  2019-03-01 14:36 ` wenxu
  2019-03-01 18:32 ` Nikolay Aleksandrov
@ 2019-03-02  8:42 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-03-02  8:42 UTC (permalink / raw)
  To: idosch; +Cc: netdev, dsahern, mlxsw, wenxu

From: Ido Schimmel <idosch@mellanox.com>
Date: Fri, 1 Mar 2019 13:38:43 +0000

> When calculating the multipath hash for input routes the flow info is
> not available and therefore should not be used.
> 
> Fixes: 24ba14406c5c ("route: Add multipath_hash in flowi_common to make user-define hash")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>

Applied.

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

end of thread, other threads:[~2019-03-02  8:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-01 13:38 [PATCH net-next] net: ipv4: Fix NULL pointer dereference in route lookup Ido Schimmel
2019-03-01 14:36 ` wenxu
2019-03-01 18:32 ` Nikolay Aleksandrov
2019-03-02  8:42 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.