| .. | .. |
|---|
| 105 | 105 | } |
|---|
| 106 | 106 | } |
|---|
| 107 | 107 | } |
|---|
| 108 | + |
|---|
| 109 | +static inline bool scm_has_secdata(struct socket *sock) |
|---|
| 110 | +{ |
|---|
| 111 | + return test_bit(SOCK_PASSSEC, &sock->flags); |
|---|
| 112 | +} |
|---|
| 108 | 113 | #else |
|---|
| 109 | 114 | static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) |
|---|
| 110 | 115 | { } |
|---|
| 116 | + |
|---|
| 117 | +static inline bool scm_has_secdata(struct socket *sock) |
|---|
| 118 | +{ |
|---|
| 119 | + return false; |
|---|
| 120 | +} |
|---|
| 111 | 121 | #endif /* CONFIG_SECURITY_NETWORK */ |
|---|
| 112 | 122 | |
|---|
| 113 | 123 | static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg, |
|---|
| 114 | 124 | struct scm_cookie *scm, int flags) |
|---|
| 115 | 125 | { |
|---|
| 116 | 126 | if (!msg->msg_control) { |
|---|
| 117 | | - if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp) |
|---|
| 127 | + if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp || |
|---|
| 128 | + scm_has_secdata(sock)) |
|---|
| 118 | 129 | msg->msg_flags |= MSG_CTRUNC; |
|---|
| 119 | 130 | scm_destroy(scm); |
|---|
| 120 | 131 | return; |
|---|