From owner-cvs-all@FreeBSD.ORG Thu Feb 24 00:48:58 2005 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0CF4116A4CE; Thu, 24 Feb 2005 00:48:58 +0000 (GMT) Received: from ebb.errno.com (ebb.errno.com [66.127.85.87]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C61B43D41; Thu, 24 Feb 2005 00:48:57 +0000 (GMT) (envelope-from sam@errno.com) Received: from [66.127.85.91] (sam@[66.127.85.91]) (authenticated bits=0) by ebb.errno.com (8.12.9/8.12.6) with ESMTP id j1O0mtWi017569 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 Feb 2005 16:48:57 -0800 (PST) (envelope-from sam@errno.com) Message-ID: <421D24A6.2070102@errno.com> Date: Wed, 23 Feb 2005 16:49:42 -0800 From: Sam Leffler User-Agent: Mozilla Thunderbird 1.0RC1 (X11/20041208) X-Accept-Language: en-us, en MIME-Version: 1.0 To: src-committers@FreeBSD.org References: <200502240040.j1O0eXdi001460@repoman.freebsd.org> In-Reply-To: <200502240040.j1O0eXdi001460@repoman.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: cvs-src@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern uipc_mbuf.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Feb 2005 00:48:58 -0000 Sam Leffler wrote: > sam 2005-02-24 00:40:33 UTC > > FreeBSD src repository > > Modified files: > sys/kern uipc_mbuf.c > Log: > change m_adj to reclaim unused mbufs instead of zero'ing m_len > when trim'ing space off the back of a chain; this is indirect > solution to a potential null ptr deref Beware of this change as it has potential to introduce subtle problems if callers are assuming the old behaviour. I checked uses of m_adj but didn't see any where the caller assumed trailing mbufs would be left. I'd argue that anyone that needs this behaviour should be changed. One might also question whether reclaming the mbufs immediately is worthwhile. Since the vast majority of uses of m_adj are to strip data from the front and not trim the back this change will mostly be a noop. The main use of tail trimming is for CRC's on rx packets where no mbuf will be reclaimed and places like ipsec. I also came across some uses in netgraph that might notice this change. But typically tail trims are for very small amounts and it's unlikely an mbuf will be made reclaimable as a result of the trim. If this change is considered good there's a clone of m_adj in the nfs code that could be changed the same way. Sam