From owner-svn-src-head@FreeBSD.ORG Mon Sep 17 08:03:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CBF1106564A; Mon, 17 Sep 2012 08:03:07 +0000 (UTC) (envelope-from bawitabooks@gmail.com) Received: from mail-ob0-f186.google.com (mail-ob0-f186.google.com [209.85.214.186]) by mx1.freebsd.org (Postfix) with ESMTP id C68F18FC08; Mon, 17 Sep 2012 08:03:06 +0000 (UTC) Received: by obbta17 with SMTP id ta17so5002999obb.13 for ; Mon, 17 Sep 2012 01:03:06 -0700 (PDT) Received: by 10.236.201.134 with SMTP id b6mr1570298yho.15.1347868986296; Mon, 17 Sep 2012 01:03:06 -0700 (PDT) X-Google-Doc-Id: b02296497a1e81be X-Google-Web-Client: true Date: Mon, 17 Sep 2012 01:03:05 -0700 (PDT) From: John Rumbaugh To: bsdmailinglist@googlegroups.com Message-Id: <6190ae24-a88a-41f7-8998-aad48184985c@googlegroups.com> In-Reply-To: <201209170732.q8H7Wsvr070014@svn.freebsd.org> References: <201209170732.q8H7Wsvr070014@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_197_16140277.1347868985469" X-Google-IP: 75.171.18.210 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, trociny@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r240595 - head/usr.sbin/bsnmpd/modules/snmp_hostres X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Sep 2012 08:03:07 -0000 ------=_Part_197_16140277.1347868985469 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit http://www.chumleaf.com On Monday, September 17, 2012 12:34:10 AM UTC-7, Mikolaj Golub wrote: > > Author: trociny > Date: Mon Sep 17 07:32:53 2012 > New Revision: 240595 > URL: http://svn.freebsd.org/changeset/base/240595 > > Log: > In snmp_hostres, device_map table is used for consistent device table > indexing. When a device has gone it is not removed from device_map > table but just its entry_p field is set to NULL. > > So when traversing device_map in disk_OS_get_ATA_disks() and > disk_OS_get_MD_disks() check for entry_p being NULL, otherwise the > bsnmpd crash is possible when a removed map entry is dereferenced. > > Before the fix, for disk_OS_get_ATA_disks() the crash could be easily > reproduced running: > > atacontrol detach ata1 > > The crash was not observed in disk_OS_get_MD_disks() because currently > snmp_hostres does no see md(4) disks: to get the device list it uses > devinfo(3), which does not return md devices. > > Reported by: Miroslav Lachman 000.fbsd quip.cz > MFC after: 1 week > > Modified: > head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c > > Modified: > head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c > ============================================================================== > > --- > head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Mon > Sep 17 07:14:07 2012 (r240594) > +++ > head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Mon > Sep 17 07:32:53 2012 (r240595) > @@ -287,6 +287,9 @@ disk_OS_get_ATA_disks(void) > > /* Walk over the device table looking for ata disks */ > STAILQ_FOREACH(map, &device_map, link) { > + /* Skip deleted entries. */ > + if (map->entry_p == NULL) > + continue; > for (found = lookup; found->media != DSM_UNKNOWN; > found++) { > if (strncmp(map->name_key, found->dev_name, > strlen(found->dev_name)) != 0) > @@ -345,6 +348,9 @@ disk_OS_get_MD_disks(void) > > /* Look for md devices */ > STAILQ_FOREACH(map, &device_map, link) { > + /* Skip deleted entries. */ > + if (map->entry_p == NULL) > + continue; > if (sscanf(map->name_key, "md%d", &unit) != 1) > continue; > > _______________________________________________ > svn-s...@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all...@freebsd.org " > > ------=_Part_197_16140277.1347868985469--