summaryrefslogtreecommitdiff
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2019-03-01 16:38:43 +0300
committerDavid S. Miller <davem@davemloft.net>2019-03-02 11:41:53 +0300
commit2a8e4997dbb2818061c76ee57d7becf390c0e4bc (patch)
tree639f27c8d29338366731bebeaaf88041280a94a4 /net/ipv4/route.c
parent04c2632a6c7487c27c91306ad2eba35fe0a59069 (diff)
downloadlinux-2a8e4997dbb2818061c76ee57d7becf390c0e4bc.tar.xz
net: ipv4: Fix NULL pointer dereference in route lookup
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> Acked-by: wenxu <wenxu@ucloud.cn> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c2
1 files changed, 1 insertions, 1 deletions
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 @@ out:
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;