From: Sreeram Ramachandran Date: Tue, 8 Jul 2014 18:57:14 +0000 (-0700) Subject: net: core: Handle 'sk' being NULL in UID-based routing X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ad493510385ee040516bf83a60e6c4921fcdfdac;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git net: core: Handle 'sk' being NULL in UID-based routing It has Amit Pundir fix: net: core: fix UID-based routing build Bug: 15413527 Change-Id: Iab1fae9da6053b284591628ef1de878761b137b1 Signed-off-by: Sreeram Ramachandran Signed-off-by: Dmitry Shmidt Signed-off-by: Amit Pundir --- 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,