]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r240595:
authortrociny <trociny@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 27 Sep 2012 18:52:04 +0000 (18:52 +0000)
committertrociny <trociny@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 27 Sep 2012 18:52:04 +0000 (18:52 +0000)
commitd1279e34ef1b6559799257cd47c51933b68e6bd6
tree518c4656361de6be58109874b3689a98ab7fe958
parentb9901f75f2a164f401dcbbdbaaa9916c2cf66f49
MFC r240595:

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

git-svn-id: svn://svn.freebsd.org/base/stable/8@241004 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c