Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Jan 2016 18:00:51 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r293594 - stable/10/sys/compat/linux
Message-ID:  <201601091800.u09I0peR069287@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sat Jan  9 18:00:51 2016
New Revision: 293594
URL: https://svnweb.freebsd.org/changeset/base/293594

Log:
  MFC r283494:
  
  Fix an mbuf(9) leak in sendmsg() under failure condition and
  remove unneeded check for failed M_WAITOK allocation.

Modified:
  stable/10/sys/compat/linux/linux_socket.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/linux/linux_socket.c
==============================================================================
--- stable/10/sys/compat/linux/linux_socket.c	Sat Jan  9 17:56:04 2016	(r293593)
+++ stable/10/sys/compat/linux/linux_socket.c	Sat Jan  9 18:00:51 2016	(r293594)
@@ -1092,8 +1092,6 @@ linux_sendmsg_common(struct thread *td, 
 		error = ENOBUFS;
 		cmsg = malloc(CMSG_HDRSZ, M_LINUX, M_WAITOK|M_ZERO);
 		control = m_get(M_WAITOK, MT_CONTROL);
-		if (control == NULL)
-			goto bad;
 
 		do {
 			error = copyin(ptr_cmsg, &linux_cmsg,
@@ -1165,6 +1163,7 @@ linux_sendmsg_common(struct thread *td, 
 	error = linux_sendit(td, s, &msg, flags, control, UIO_USERSPACE);
 
 bad:
+	m_freem(control);
 	free(iov, M_IOV);
 	if (cmsg)
 		free(cmsg, M_LINUX);



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