Lines Matching refs:scm
140 static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) in unix_get_secdata() argument
142 UNIXCB(skb).secid = scm->secid; in unix_get_secdata()
145 static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) in unix_set_secdata() argument
147 scm->secid = UNIXCB(skb).secid; in unix_set_secdata()
150 static inline bool unix_secdata_eq(struct scm_cookie *scm, struct sk_buff *skb) in unix_secdata_eq() argument
152 return (scm->secid == UNIXCB(skb).secid); in unix_secdata_eq()
155 static inline void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) in unix_get_secdata() argument
158 static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) in unix_set_secdata() argument
161 static inline bool unix_secdata_eq(struct scm_cookie *scm, struct sk_buff *skb) in unix_secdata_eq() argument
1617 static void unix_peek_fds(struct scm_cookie *scm, struct sk_buff *skb) in unix_peek_fds() argument
1619 scm->fp = scm_fp_dup(UNIXCB(skb).fp); in unix_peek_fds()
1664 static int unix_scm_to_skb(struct scm_cookie *scm, struct sk_buff *skb, bool send_fds) in unix_scm_to_skb() argument
1668 UNIXCB(skb).pid = get_pid(scm->pid); in unix_scm_to_skb()
1669 UNIXCB(skb).uid = scm->creds.uid; in unix_scm_to_skb()
1670 UNIXCB(skb).gid = scm->creds.gid; in unix_scm_to_skb()
1672 unix_get_secdata(scm, skb); in unix_scm_to_skb()
1673 if (scm->fp && send_fds) in unix_scm_to_skb()
1674 err = unix_attach_fds(scm, skb); in unix_scm_to_skb()
1704 static int maybe_init_creds(struct scm_cookie *scm, in maybe_init_creds() argument
1711 err = scm_send(socket, &msg, scm, false); in maybe_init_creds()
1716 scm->pid = get_pid(task_tgid(current)); in maybe_init_creds()
1717 current_uid_gid(&scm->creds.uid, &scm->creds.gid); in maybe_init_creds()
1723 struct scm_cookie *scm) in unix_skb_scm_eq() argument
1727 return u->pid == scm->pid && in unix_skb_scm_eq()
1728 uid_eq(u->uid, scm->creds.uid) && in unix_skb_scm_eq()
1729 gid_eq(u->gid, scm->creds.gid) && in unix_skb_scm_eq()
1730 unix_secdata_eq(scm, skb); in unix_skb_scm_eq()
1768 struct scm_cookie scm; in unix_dgram_sendmsg() local
1773 err = scm_send(sock, msg, &scm, false); in unix_dgram_sendmsg()
1817 err = unix_scm_to_skb(&scm, skb, true); in unix_dgram_sendmsg()
1943 scm_destroy(&scm); in unix_dgram_sendmsg()
1955 scm_destroy(&scm); in unix_dgram_sendmsg()
2019 struct scm_cookie scm; in unix_stream_sendmsg() local
2024 err = scm_send(sock, msg, &scm, false); in unix_stream_sendmsg()
2071 err = unix_scm_to_skb(&scm, skb, !fds_sent); in unix_stream_sendmsg()
2110 scm_destroy(&scm); in unix_stream_sendmsg()
2122 scm_destroy(&scm); in unix_stream_sendmsg()
2132 struct scm_cookie scm; in unix_stream_sendpage() local
2178 err = maybe_init_creds(&scm, socket, other); in unix_stream_sendpage()
2187 } else if (!skb || !unix_skb_scm_eq(skb, &scm)) { in unix_stream_sendpage()
2214 err = unix_scm_to_skb(&scm, skb, false); in unix_stream_sendpage()
2226 scm_destroy(&scm); in unix_stream_sendpage()
2238 scm_destroy(&scm); in unix_stream_sendpage()
2285 struct scm_cookie scm; in __unix_dgram_recvmsg() local
2349 memset(&scm, 0, sizeof(scm)); in __unix_dgram_recvmsg()
2351 scm_set_cred(&scm, UNIXCB(skb).pid, UNIXCB(skb).uid, UNIXCB(skb).gid); in __unix_dgram_recvmsg()
2352 unix_set_secdata(&scm, skb); in __unix_dgram_recvmsg()
2356 unix_detach_fds(&scm, skb); in __unix_dgram_recvmsg()
2376 unix_peek_fds(&scm, skb); in __unix_dgram_recvmsg()
2380 scm_recv(sock, msg, &scm, flags); in __unix_dgram_recvmsg()
2580 struct scm_cookie scm; in unix_stream_read_generic() local
2611 memset(&scm, 0, sizeof(scm)); in unix_stream_read_generic()
2673 scm_destroy(&scm); in unix_stream_read_generic()
2697 if (!unix_skb_scm_eq(skb, &scm)) in unix_stream_read_generic()
2701 scm_set_cred(&scm, UNIXCB(skb).pid, UNIXCB(skb).uid, UNIXCB(skb).gid); in unix_stream_read_generic()
2702 unix_set_secdata(&scm, skb); in unix_stream_read_generic()
2748 unix_detach_fds(&scm, skb); in unix_stream_read_generic()
2757 if (scm.fp) in unix_stream_read_generic()
2763 unix_peek_fds(&scm, skb); in unix_stream_read_generic()
2784 scm_recv(sock, state->msg, &scm, flags); in unix_stream_read_generic()
2786 scm_destroy(&scm); in unix_stream_read_generic()