1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-04 12:52:15 +00:00

- Add some needed error checking on bad fd passing in the sctp

syscalls.
Approved by:	re@freebsd.org (Ken Smith)
Obtained from:	Weongyo Jeong (weongyo.jeong@gmail.com)
This commit is contained in:
Randall Stewart 2007-07-02 12:50:53 +00:00
parent 602afc03e4
commit b8709d23c5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171153

View File

@ -2364,7 +2364,7 @@ sctp_generic_sendmsg (td, uap)
#ifdef SCTP
struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL;
struct socket *so;
struct file *fp;
struct file *fp = NULL;
int use_rcvinfo = 1;
int error = 0, len;
struct sockaddr *to = NULL;
@ -2436,7 +2436,8 @@ sctp_generic_sendmsg (td, uap)
}
#endif /* KTRACE */
sctp_bad:
fdrop(fp, td);
if (fp)
fdrop(fp, td);
sctp_bad2:
if (to)
free(to, M_SONAME);
@ -2462,7 +2463,7 @@ sctp_generic_sendmsg_iov(td, uap)
#ifdef SCTP
struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL;
struct socket *so;
struct file *fp;
struct file *fp = NULL;
int use_rcvinfo = 1;
int error=0, len, i;
struct sockaddr *to = NULL;
@ -2544,7 +2545,8 @@ sctp_generic_sendmsg_iov(td, uap)
sctp_bad:
free(iov, M_IOV);
sctp_bad1:
fdrop(fp, td);
if (fp)
fdrop(fp, td);
sctp_bad2:
if (to)
free(to, M_SONAME);
@ -2573,7 +2575,7 @@ sctp_generic_recvmsg(td, uap)
struct iovec *iov, *tiov;
struct sctp_sndrcvinfo sinfo;
struct socket *so;
struct file *fp;
struct file *fp = NULL;
struct sockaddr *fromsa;
int fromlen;
int len, i, msg_flags;
@ -2684,7 +2686,9 @@ sctp_generic_recvmsg(td, uap)
out:
free(iov, M_IOV);
out1:
fdrop(fp, td);
if (fp)
fdrop(fp, td);
return (error);
#else /* SCTP */
return (EOPNOTSUPP);