Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 1998 12:03:24 -0500 (EST)
From:      woods@zeus.leitch.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/5979: sd.c doesn't validate all mode sense 4 values, esp. secsize
Message-ID:  <199803111703.MAA02504@bitter.zeus.leitch.com>

next in thread | raw e-mail | index | archive | help

>Number:         5979
>Category:       kern
>Synopsis:       sd.c doesn't validate all mode sense 4 values, esp. secsize
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 11 09:10:01 PST 1998
>Last-Modified:
>Originator:     Greg A. Woods
>Organization:
Planix, Inc.; on contract at Leitch Technology International, Inc.
>Release:        FreeBSD 2.2.5-STABLE i386
>Environment:

System: ASUS P2L97 motherboard with i686 class CPU and 128MB SDRAM
SCSI Host Adapter: Adaptec AHA-2940UW (BIOS v1.32)
Disk Array Controller: Adaptec AEC-4312A

>Description:

The sd driver probes and reports incorrect values from an Adaptec
AEC-4312A SCSI RAID controller.  Notably the sector size (and thus the
calculated volume size) is invalid.

This problem was initially noted in the 2.2.5-stable (RELENG_2_2
branch cvsup'ed as of 1998/01/26), but the latest 3.0-SNAP boot floppy
also exhibited the same problem.

>How-To-Repeat:

Boot any FreeBSD on a system with an attached Adaptec AEC-4312A SCSI
RAID array and inspect the sector size reported.

>Fix:
	
Upon inspection of and comparison with the NetBSD-1.3 release code,
which does correctly identify bogus values from the mode sense and
reports the correct sector size and calculated volume size using the
traditional Adaptec "fictitious" geometry, we noted that the FreeBSD
code was not clearing the scsi_sense data structure (presumably to
allow detection of fields not set in the mode page), nor was the
sector size being forced to a logical value when the rest of the
geometry was corrected.

The attached patch solves the problem (but we've not verified that all
related problems have been solved -- the logic in NetBSD's version of
this code is considerably different and seems to handle more potential
conditions).

=== cd /usr/src/sys/scsi/
=== /usr/bin/cvs diff -c sd.c

Index: sd.c
===================================================================
RCS file: /cvs/Leitch/FreeBSD-2.2/sys/scsi/sd.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 sd.c
*** sd.c	1998/01/21 23:19:16	1.1.1.1
--- sd.c	1998/02/11 18:33:08
***************
*** 725,730 ****
--- 725,731 ----
  	/*
  	 * do a "mode sense page 4"
  	 */
+ 	bzero(&scsi_sense, sizeof(scsi_sense));
  	bzero(&scsi_cmd, sizeof(scsi_cmd));
  	scsi_cmd.op_code = MODE_SENSE;
  	scsi_cmd.page = 4;
***************
*** 791,796 ****
--- 792,798 ----
  			disk_parms->heads = 64;
  			disk_parms->cyls = sectors / (64 * 32);
  			sectors = 32;
+ 			disk_parms->secsiz = SECSIZE;
  		}
  		/* keep secsiz sane too - we may divide by it later */
  		if(disk_parms->secsiz == 0)

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803111703.MAA02504>