Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Mar 2016 15:55:43 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r296504 - head/sys/compat/linux
Message-ID:  <201603081555.u28FthsQ022102@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603081555.u28FthsQ022102>