diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2017-01-03 11:23:35 -0800 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2017-01-03 11:23:35 -0800 |
commit | aceae9be74c70f993ddd8d6a157f1a256591c43f (patch) | |
tree | d8ef291e4467dfd1d28e31e8a2f38049fdcece2c /include/net/sock.h | |
parent | 9b133b6207826ae8cbe5f7de0b407253191e98fa (diff) | |
parent | 676b8efcce52d582153d3df3bc90689cab07a058 (diff) |
Merge remote-tracking branch 'common/android-4.4' into android-4.4.y
Change-Id: I44dc2744898ca59ad15cd77b49ad84da0220250a
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 8f77df63a8f4..62c9e2268d63 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -446,6 +446,7 @@ struct sock { void *sk_security; #endif __u32 sk_mark; + kuid_t sk_uid; #ifdef CONFIG_CGROUP_NET_CLASSID u32 sk_classid; #endif @@ -1692,6 +1693,7 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) sk->sk_wq = parent->wq; parent->sk = sk; sk_set_socket(sk, parent); + sk->sk_uid = SOCK_INODE(parent)->i_uid; security_sock_graft(sk, parent); write_unlock_bh(&sk->sk_callback_lock); } @@ -1699,6 +1701,11 @@ static inline void sock_graft(struct sock *sk, struct socket *parent) kuid_t sock_i_uid(struct sock *sk); unsigned long sock_i_ino(struct sock *sk); +static inline kuid_t sock_net_uid(const struct net *net, const struct sock *sk) +{ + return sk ? sk->sk_uid : make_kuid(net->user_ns, 0); +} + static inline u32 net_tx_rndhash(void) { u32 v = prandom_u32(); |