PSARC 2007/670 db_credp update
6619593 Simplify and strengthen db_credp handling
6619596 Add getpeerucred() support to SCTP SOCK_STREAM
diff --git a/usr/src/uts/common/fs/sockfs/sockcommon_subr.c b/usr/src/uts/common/fs/sockfs/sockcommon_subr.c
index 8988286..c8ff2be 100644
--- a/usr/src/uts/common/fs/sockfs/sockcommon_subr.c
+++ b/usr/src/uts/common/fs/sockfs/sockcommon_subr.c
@@ -468,7 +468,7 @@
 /* Copy userdata into a new mblk_t */
 mblk_t *
 socopyinuio(uio_t *uiop, ssize_t iosize, size_t wroff, ssize_t maxblk,
-    size_t tail_len, int *errorp)
+    size_t tail_len, int *errorp, cred_t *cr)
 {
 	mblk_t	*head = NULL, **tail = &head;
 
@@ -496,8 +496,12 @@
 
 		blocksize = MIN(iosize, maxblk);
 		ASSERT(blocksize >= 0);
-		if ((mp = allocb(wroff + blocksize + tail_len,
-		    BPRI_MED)) == NULL) {
+		if (is_system_labeled())
+			mp = allocb_cred(wroff + blocksize + tail_len,
+			    cr, curproc->p_pid);
+		else
+			mp = allocb(wroff + blocksize + tail_len, BPRI_MED);
+		if (mp == NULL) {
 			*errorp = ENOMEM;
 			return (head);
 		}