net: core: Handle 'sk' being NULL in UID-based routing
authorSreeram Ramachandran <sreeram@google.com>
Tue, 8 Jul 2014 18:57:14 +0000 (11:57 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Tue, 16 Feb 2016 21:51:37 +0000 (13:51 -0800)
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>
include/net/route.h
net/ipv4/route.c

index bf6fe1a6527e0e074630a8773aa12b6c5c8bdc6d..d016a8cb45cfb14684bbec4b04702592d65c72e9 100644 (file)
@@ -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);
index 4704ddcf2e7ce3b6c08550f2e5265bafb3749716..a0d842f4e9cf376213dad9e0efa99a97d16e3611 100644 (file)
@@ -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,