Bug 141936 - a couple of bugs in scsi_info.c
Summary: a couple of bugs in scsi_info.c
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: kernel-pcmcia-cs
Version: 2.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Pete Zaitcev
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-12-06 08:33 UTC by Ken Sugawara
Modified: 2007-11-30 22:06 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-10-19 19:21:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
This version of scsi_info fixes the first problem mentioned in the bug (4.13 KB, application/octet-stream)
2006-05-08 18:20 UTC, NetApp filed bugzillas
no flags Details

Description Ken Sugawara 2004-12-06 08:33:42 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5)
Gecko/20031007

Description of problem:
I found a couple of bugs in scsi_info.c that prevent it from working
properly with devices if channel/id/lun >= 10.  A real example follows:

# scsi_info /dev/sdl
SCSI_ID="0,0,10"
MODEL="Direct-A "
FW_REV="SCSI"

1. format string disagreement with /proc/scsi/scsi

When scsi_format reads /proc/scsi/scsi, its forms the match string as
the following (at line 122-123):
    sprintf(match, "Host: scsi%d Channel: %02x Id: %02x Lun: %02x\n",
	    host, channel, id, lun);
whereas kernel 2.4.9-e.49's drivers/scsi/scsi_proc.c says (at L265-267):
	y = sprintf(buffer + len,
	     "Host: scsi%d Channel: %02d Id: %02d Lun: %02d\n  Vendor: ",
		    scd->host->host_no, scd->channel, scd->id, scd->lun);

Suggested fix: 122s/%02x/%02d/g

2. EOF not checked when falling through

At line 133-135 of scsi_info.c:
    while (fgets(s, 128, f) != NULL)
	if (strcmp(s, match) == 0) break;
    fgets(s, 128, f);

Because EOF is never checked, scsi_info.c spits out garbage like the
example above when no match is found due to malformatted match string.
 Although this one can be left unfixed if the first bug is fixed, I
think it should be fixed for the sake of promoting good programming style.




Version-Release number of selected component (if applicable):
kernel-pcmcia-cs-3.1.27

How reproducible:
Always

Steps to Reproduce:
1. Connect a SCSI device (e.g. RAID) that has more than 10 LUNs
2. run scsi_info on the 10th LUN (e.g. scsi_info /dev/sdl)

    

Actual Results:  # scsi_info /dev/sdl
SCSI_ID="0,0,10"
MODEL="Direct-A "
FW_REV="SCSI"


Expected Results:  # scsi_info /dev/sdl
SCSI_ID="0,0,10"
MODEL="DGC RAID 5"
FW_REV="0207"


Additional info:

There's no workaround to this problem except avoiding use of scsi_info.

Comment 1 NetApp filed bugzillas 2006-05-08 18:20:36 UTC
Created attachment 128757 [details]
This version of scsi_info fixes the first problem mentioned in the bug

Comment 2 RHEL Program Management 2007-10-19 19:21:14 UTC
This bug is filed against RHEL2.1, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products.  Since
this bug does not meet that criteria, it is now being closed.

For more information of the RHEL errata support policy, please visit:
http://www.redhat.com/security/updates/errata/

If you feel this bug is indeed mission critical, please contact your
support representative.  You may be asked to provide detailed
information on how this bug is affecting you.


Note You need to log in before you can comment on or make changes to this bug.