diff options
author | Sreeram Ramachandran <sreeram@google.com> | 2014-07-08 11:57:14 -0700 |
---|---|---|
committer | Daniel Thompson <daniel.thompson@linaro.org> | 2015-10-21 17:00:49 +0100 |
commit | a319a5c4202b47def2df1e8f08ec568fc29e5043 (patch) | |
tree | e64e7d8528eaad17614d9584808b07a5f7d7bcae | |
parent | 1520bdcadb1dccf388292b09645d2e77283cd5f4 (diff) |
Handle 'sk' being NULL in UID-based routing.
Bug: 15413527
Change-Id: Iab1fae9da6053b284591628ef1de878761b137b1
Signed-off-by: Sreeram Ramachandran <sreeram@google.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r-- | include/net/route.h | 2 | ||||
-rw-r--r-- | net/ipv4/route.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/net/route.h b/include/net/route.h index 8fc12b318f0d..298b62ebcb8c 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -142,7 +142,7 @@ 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) : 0); 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 e1539845808a..3a7f1cf2f6ce 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -515,7 +515,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) : 0); } static void build_skb_flow_key(struct flowi4 *fl4, const struct sk_buff *skb, |