| 122 | } |
| 123 | |
| 124 | static struct label * |
| 125 | mac_socketpeer_label_alloc(int flag) |
| 126 | { |
| 127 | struct label *label; |
| 128 | int error; |
| 129 | |
| 130 | label = mac_labelzone_alloc(flag); |
| 131 | if (label == NULL) |
| 132 | return (NULL); |
| 133 | |
| 134 | if (flag & M_WAITOK) |
| 135 | MAC_POLICY_CHECK(socketpeer_init_label, label, flag); |
| 136 | else |
| 137 | MAC_POLICY_CHECK_NOSLEEP(socketpeer_init_label, label, flag); |
| 138 | if (error) { |
| 139 | MAC_POLICY_PERFORM_NOSLEEP(socketpeer_destroy_label, label); |
| 140 | mac_labelzone_free(label); |
| 141 | return (NULL); |
| 142 | } |
| 143 | return (label); |
| 144 | } |
| 145 | |
| 146 | int |
| 147 | mac_socket_init(struct socket *so, int flag) |
no test coverage detected