summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/inet/udp/udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/inet/udp/udp.c')
-rw-r--r--usr/src/uts/common/inet/udp/udp.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/usr/src/uts/common/inet/udp/udp.c b/usr/src/uts/common/inet/udp/udp.c
index ff83382a1c..bd0599c115 100644
--- a/usr/src/uts/common/inet/udp/udp.c
+++ b/usr/src/uts/common/inet/udp/udp.c
@@ -3128,6 +3128,8 @@ udp_output_ancillary(conn_t *connp, sin_t *sin, sin6_t *sin6, mblk_t *mp,
/* Get a copy of conn_xmit_ipp since the options might change it */
ipp = kmem_zalloc(sizeof (*ipp), KM_NOSLEEP);
if (ipp == NULL) {
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
ixa_refrele(ixa);
BUMP_MIB(&us->us_udp_mib, udpOutErrors);
freemsg(mp);
@@ -3357,6 +3359,8 @@ udp_output_ancillary(conn_t *connp, sin_t *sin, sin6_t *sin6, mblk_t *mp,
break;
}
done:
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
ixa_refrele(ixa);
ip_pkt_free(ipp);
kmem_free(ipp, sizeof (*ipp));
@@ -3397,6 +3401,8 @@ udp_output_connected(conn_t *connp, mblk_t *mp, cred_t *cr, pid_t pid)
if (mp == NULL) {
ASSERT(error != 0);
mutex_exit(&connp->conn_lock);
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
ixa_refrele(ixa);
BUMP_MIB(&us->us_udp_mib, udpOutErrors);
freemsg(mp);
@@ -3452,6 +3458,8 @@ udp_output_connected(conn_t *connp, mblk_t *mp, cred_t *cr, pid_t pid)
/* FALLTHRU */
default:
failed:
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
ixa_refrele(ixa);
freemsg(mp);
BUMP_MIB(&us->us_udp_mib, udpOutErrors);
@@ -3483,6 +3491,8 @@ udp_output_connected(conn_t *connp, mblk_t *mp, cred_t *cr, pid_t pid)
error = ENETUNREACH;
break;
}
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
ixa_refrele(ixa);
return (error);
}
@@ -3514,6 +3524,8 @@ udp_output_lastdst(conn_t *connp, mblk_t *mp, cred_t *cr, pid_t pid,
if (mp == NULL) {
ASSERT(error != 0);
mutex_exit(&connp->conn_lock);
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
ixa_refrele(ixa);
BUMP_MIB(&us->us_udp_mib, udpOutErrors);
freemsg(mp);
@@ -3569,6 +3581,8 @@ udp_output_lastdst(conn_t *connp, mblk_t *mp, cred_t *cr, pid_t pid,
/* FALLTHRU */
default:
failed:
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
ixa_refrele(ixa);
freemsg(mp);
BUMP_MIB(&us->us_udp_mib, udpOutErrors);
@@ -3612,6 +3626,8 @@ udp_output_lastdst(conn_t *connp, mblk_t *mp, cred_t *cr, pid_t pid,
mutex_exit(&connp->conn_lock);
break;
}
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
ixa_refrele(ixa);
return (error);
}
@@ -4409,12 +4425,15 @@ udp_output_newdst(conn_t *connp, mblk_t *data_mp, sin_t *sin, sin6_t *sin6,
mutex_exit(&connp->conn_lock);
break;
}
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
ixa_refrele(ixa);
return (error);
ud_error:
- if (ixa != NULL)
- ixa_refrele(ixa);
+ ixa->ixa_cred = connp->conn_cred; /* Restore */
+ ixa->ixa_cpid = connp->conn_cpid;
+ ixa_refrele(ixa);
freemsg(data_mp);
BUMP_MIB(&us->us_udp_mib, udpOutErrors);
@@ -6200,6 +6219,15 @@ udp_do_connect(conn_t *connp, const struct sockaddr *sa, socklen_t len,
}
mutex_exit(&udpf->uf_lock);
+ /*
+ * We update our cred/cpid based on the caller of connect
+ */
+ if (connp->conn_cred != cr) {
+ crhold(cr);
+ crfree(connp->conn_cred);
+ connp->conn_cred = cr;
+ }
+ connp->conn_cpid = pid;
ixa->ixa_cred = cr;
ixa->ixa_cpid = pid;
if (is_system_labeled()) {