Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Nov 2000 23:33:33 -0500
From:      "Danny J. Zerkel" <dzerkel@columbus.rr.com>
To:        FreeBSD Current <freebsd-current@FreeBSD.ORG>, dillon@FreeBSD.ORG
Subject:   RE: COMPAT_SVR4 broken after uipc_syscalls commit (1.77)
Message-ID:  <3A1C9E1D.574887CE@columbus.rr.com>

next in thread | raw e-mail | index | archive | help
Okay, this time I'll even include the entire patch...

-- Danny J. Zerkel
dzerkel@columbus.rr.com

--- svr4_stream.c.orig  Thu Aug 31 18:54:05 2000
+++ svr4_stream.c       Wed Nov 22 22:39:00 2000
@@ -162,7 +162,7 @@
        struct uio ktruio;
 #endif
 
-       error = getsock(p->p_fd, s, &fp);
+       error = holdsock(p->p_fd, s, &fp);
        if (error)
                return (error);
        auio.uio_iov = mp->msg_iov;
@@ -174,13 +174,17 @@
        auio.uio_resid = 0;
        iov = mp->msg_iov;
        for (i = 0; i < mp->msg_iovlen; i++, iov++) {
-               if ((auio.uio_resid += iov->iov_len) < 0)
+               if ((auio.uio_resid += iov->iov_len) < 0) {
+                       fdrop(fp, p);
                        return (EINVAL);
+               }
        }
        if (mp->msg_name) {
                error = getsockaddr(&to, mp->msg_name, mp->msg_namelen);
-               if (error)
+               if (error) {
+                       fdrop(fp, p);
                        return (error);
+               }
        } else
                to = 0;
        if (mp->msg_control) {
@@ -229,6 +233,7 @@
 bad:
        if (to)
                FREE(to, M_SONAME);
+       fdrop(fp, p);
        return (error);
 }
 
@@ -253,7 +258,7 @@
        struct uio ktruio;
 #endif
 
-       error = getsock(p->p_fd, s, &fp);
+       error = holdsock(p->p_fd, s, &fp);
        if (error)
                return (error);
        auio.uio_iov = mp->msg_iov;
@@ -265,8 +270,10 @@
        auio.uio_resid = 0;
        iov = mp->msg_iov;
        for (i = 0; i < mp->msg_iovlen; i++, iov++) {
-               if ((auio.uio_resid += iov->iov_len) < 0)
+               if ((auio.uio_resid += iov->iov_len) < 0) {
+                       fdrop(fp, p);
                        return (EINVAL);
+               }
        }
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_GENIO)) {
@@ -352,6 +359,7 @@
                FREE(fromsa, M_SONAME);
        if (control)
                m_freem(control);
+       fdrop(fp, p);
        return (error);
 }


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A1C9E1D.574887CE>