diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2002-10-05 17:44:49 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2002-10-05 17:44:49 +0000 |
| commit | 56c1541237b41af66a5bb4788de6d6002b471ffb (patch) | |
| tree | 59bbb9f14f4a347ee58f124d8180cfe091c061e3 /sys/kern/kern_mac.c | |
| parent | 87807196f8ac486b66e1ffcd12fe4043142cd12a (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_mac.c')
| -rw-r--r-- | sys/kern/kern_mac.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/kern/kern_mac.c b/sys/kern/kern_mac.c index dd5d2b35e9f8..d21d5df98993 100644 --- a/sys/kern/kern_mac.c +++ b/sys/kern/kern_mac.c @@ -1101,15 +1101,23 @@ mac_init_ipq(struct ipq *ipq) int mac_init_mbuf(struct mbuf *m, int flag) { + int error; + KASSERT(m->m_flags & M_PKTHDR, ("mac_init_mbuf on non-header mbuf")); mac_init_label(&m->m_pkthdr.label); - MAC_PERFORM(init_mbuf_label, &m->m_pkthdr.label, flag); + MAC_CHECK(init_mbuf_label, &m->m_pkthdr.label, flag); + if (error) { + MAC_PERFORM(destroy_mbuf_label, &m->m_pkthdr.label); + mac_destroy_label(&m->m_pkthdr.label); + } + #ifdef MAC_DEBUG - atomic_add_int(&nmacmbufs, 1); + if (error == 0) + atomic_add_int(&nmacmbufs, 1); #endif - return (0); + return (error); } void |
