summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSreeram Ramachandran <sreeram@google.com>2014-07-08 11:57:14 -0700
committerJohn Stultz <john.stultz@linaro.org>2016-02-16 13:51:37 -0800
commitad493510385ee040516bf83a60e6c4921fcdfdac (patch)
tree97204875e23e9969a7e1470db329cff24cc4e093
parentfd2cf795f3ab193752781be7372949ac1780d0ed (diff)
net: core: Handle 'sk' being NULL in UID-based routing
It has Amit Pundir <amit.pundir@linaro.org> fix: net: core: fix UID-based routing build Bug: 15413527 Change-Id: Iab1fae9da6053b284591628ef1de878761b137b1 Signed-off-by: Sreeram Ramachandran <sreeram@google.com> Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
-rw-r--r--include/net/route.h3
-rw-r--r--net/ipv4/route.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/include/net/route.h b/include/net/route.h
index bf6fe1a6527e..d016a8cb45cf 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -154,7 +154,8 @@ static inline struct rtable *ip_route_output_ports(struct net *net, struct flowi
flowi4_init_output(fl4, oif, sk ? sk->sk_mark : 0, tos,
RT_SCOPE_UNIVERSE, proto,
sk ? inet_sk_flowi_flags(sk) : 0,
- daddr, saddr, dport, sport, sock_i_uid(sk));
+ daddr, saddr, dport, sport,
+ sk ? sock_i_uid(sk) : GLOBAL_ROOT_UID);
if (sk)
security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
return ip_route_output_flow(net, fl4, sk);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4704ddcf2e7c..a0d842f4e9cf 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -517,7 +517,7 @@ static void __build_flow_key(struct flowi4 *fl4, struct sock *sk,
RT_SCOPE_UNIVERSE, prot,
flow_flags,
iph->daddr, iph->saddr, 0, 0,
- sock_i_uid(sk));
+ sk ? sock_i_uid(sk) : GLOBAL_ROOT_UID);
}
static void build_skb_flow_key(struct flowi4 *fl4, const struct sk_buff *skb,