svn commit: r296504 - head/sys/compat/linux

Dmitry Chagin dchagin at FreeBSD.org
Tue Mar 8 15:55:44 UTC 2016


Author: dchagin
Date: Tue Mar  8 15:55:43 2016
New Revision: 296504
URL: https://svnweb.freebsd.org/changeset/base/296504

Log:
  Does not leak fp. While here remove bogus cast of fp->f_data.
  
  MFC after:	1 week

Modified:
  head/sys/compat/linux/linux_socket.c

Modified: head/sys/compat/linux/linux_socket.c
==============================================================================
--- head/sys/compat/linux/linux_socket.c	Tue Mar  8 15:15:34 2016	(r296503)
+++ head/sys/compat/linux/linux_socket.c	Tue Mar  8 15:55:43 2016	(r296504)
@@ -803,9 +803,12 @@ linux_accept_common(struct thread *td, i
 			error1 = getsock_cap(td, s, &rights, &fp, NULL);
 			if (error1 != 0)
 				return (error1);
-			so = (struct socket *)fp->f_data;
-			if (so->so_type == SOCK_DGRAM)
+			so = fp->f_data;
+			if (so->so_type == SOCK_DGRAM) {
+				fdrop(fp, td);
 				return (EOPNOTSUPP);
+			}
+			fdrop(fp, td);
 		}
 		return (error);
 	}


More information about the svn-src-all mailing list