MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mac_syncache_init

Function mac_syncache_init

freebsd/security/mac/mac_inet.c:457–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457int
458mac_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
486void
487mac_syncache_create(struct label *label, struct inpcb *inp)

Callers 1

syncache_addFunction · 0.85

Calls 2

mac_labelzone_allocFunction · 0.85
mac_labelzone_freeFunction · 0.85

Tested by

no test coverage detected