Date: Tue, 14 Apr 1998 01:38:25 +0200 From: pb@fasterix.freenix.org (Pierre Beyssac) To: phk@FreeBSD.ORG (Poul-Henning Kamp) Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, cvs-sys@FreeBSD.ORG Subject: Re: cvs commit: src/sys/kern uipc_syscalls.c Message-ID: <19980414013825.TH38245@@> In-Reply-To: <199804112031.NAA01564@freefall.freebsd.org>; from Poul-Henning Kamp on Apr 11, 1998 13:31:46 -0700 References: <199804112031.NAA01564@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp writes:
> setsockopt() transports user option data in an mbuf. if the user
> data is greater than MLEN, setsockopt is unable to pass it onto
> the protocol handler. Allocate a cluster in such case.
Hum, there is a very similar patch in the INRIA IPv6 patches, except
it does an additional m_free(m) before returning. Shouldn't the
following patch be added to your code to avoid a mbuf leak ?
--- uipc_syscalls.c.orig Mon Apr 13 02:01:29 1998
+++ uipc_syscalls.c Tue Apr 14 01:31:09 1998
@@ -992,10 +992,12 @@
if (m == NULL)
return (ENOBUFS);
if (uap->valsize > MLEN) {
MCLGET(m, M_WAIT);
- if(!(m->m_flags & M_EXT))
+ if(!(m->m_flags & M_EXT)) {
+ m_free(m);
return (ENOBUFS);
+ }
}
error = copyin(uap->val, mtod(m, caddr_t), (u_int)uap->valsize);
if (error) {
(void) m_free(m);
--
Pierre Beyssac pb@fasterix.frmug.org pb@fasterix.freenix.org
{Free,Net,Open}BSD, Linux : il y a moins bien, mais c'est plus cher
Free domains: http://www.eu.org/ or mail dns-manager@EU.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980414013825.TH38245>
