| 100 | */ |
| 101 | |
| 102 | struct label * |
| 103 | mac_socket_label_alloc(int flag) |
| 104 | { |
| 105 | struct label *label; |
| 106 | int error; |
| 107 | |
| 108 | label = mac_labelzone_alloc(flag); |
| 109 | if (label == NULL) |
| 110 | return (NULL); |
| 111 | |
| 112 | if (flag & M_WAITOK) |
| 113 | MAC_POLICY_CHECK(socket_init_label, label, flag); |
| 114 | else |
| 115 | MAC_POLICY_CHECK_NOSLEEP(socket_init_label, label, flag); |
| 116 | if (error) { |
| 117 | MAC_POLICY_PERFORM_NOSLEEP(socket_destroy_label, label); |
| 118 | mac_labelzone_free(label); |
| 119 | return (NULL); |
| 120 | } |
| 121 | return (label); |
| 122 | } |
| 123 | |
| 124 | static struct label * |
| 125 | mac_socketpeer_label_alloc(int flag) |
no test coverage detected