| 455 | } |
| 456 | |
| 457 | int |
| 458 | mac_syncache_init(struct label **label) |
| 459 | { |
| 460 | int error; |
| 461 | |
| 462 | if (mac_labeled & MPC_OBJECT_SYNCACHE) { |
| 463 | *label = mac_labelzone_alloc(M_NOWAIT); |
| 464 | if (*label == NULL) |
| 465 | return (ENOMEM); |
| 466 | /* |
| 467 | * Since we are holding the inpcb locks the policy can not |
| 468 | * allocate policy specific label storage using M_WAITOK. So |
| 469 | * we need to do a MAC_CHECK instead of the typical |
| 470 | * MAC_PERFORM so we can propagate allocation failures back |
| 471 | * to the syncache code. |
| 472 | */ |
| 473 | MAC_POLICY_CHECK_NOSLEEP(syncache_init_label, *label, |
| 474 | M_NOWAIT); |
| 475 | if (error) { |
| 476 | MAC_POLICY_PERFORM_NOSLEEP(syncache_destroy_label, |
| 477 | *label); |
| 478 | mac_labelzone_free(*label); |
| 479 | } |
| 480 | return (error); |
| 481 | } else |
| 482 | *label = NULL; |
| 483 | return (0); |
| 484 | } |
| 485 | |
| 486 | void |
| 487 | mac_syncache_create(struct label *label, struct inpcb *inp) |
no test coverage detected