From owner-freebsd-net Tue Nov 5 9:25:41 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5AAF437B401 for ; Tue, 5 Nov 2002 09:25:40 -0800 (PST) Received: from mail.otel.net (gw3.OTEL.net [212.36.8.151]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE3F343E3B for ; Tue, 5 Nov 2002 09:25:37 -0800 (PST) (envelope-from ikostov@otel.net) Received: from judicator.otel.net ([212.36.9.113]) by mail.otel.net with esmtp (Exim 3.36 #1) id 1897SH-0002eB-00 for freebsd-net@freebsd.org; Tue, 05 Nov 2002 19:25:33 +0200 Date: Tue, 5 Nov 2002 19:25:33 +0200 (EET) From: Iasen Kostov To: freebsd-net@freebsd.org Subject: NFS functions does *NOT* check if they really have allocated any memory Message-ID: <20021105183154.I80368-100000@shadowhand.OTEL.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org As I experience system crushes at time of mbufs exhaustion I've compiled a debug kernel and traced the problem. I seems the NFS functions (nfsm_rpchead, nfsm_reqh ...) does *NOT* chek if they really have allocated memory by MGET macro. First problem that I saw was in nfsm_reqh at nfs/nfs_subs.c:593 (4.7-STABLE). I've added a check for mb == 0 - if so function just retuns NULL. But here raise another problem in "second level" functions - they don't check what lower level functions return , thus they crush kernel if the lower level functions return NULL. You could see it in nfs3_access_otw at nfs_vnops.c:293 - there is absent a check for value returned by nfsm_reqhead macro which calls nfsm_reqh(). I've looked at the other parts of kernel (drivers mainly) and I saw that after MGET allocations drivers check if they really have allocated mbufs (xl dirver) (which is not true for NFS :). Why NFS functions doesn't care if they really have allocated mbufs ? :), and I think they should care. regards To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message