Date: Tue, 22 Mar 2005 10:33:55 -0600 From: "Henry Miller" <hank@blackhole.com> To: freebsd-scsi@freebsd.org Subject: scsi_ch issues Message-ID: <380-220053222163355859@blackhole.com>
next in thread | raw e-mail | index | archive | help
I posted a summery of this to -questions earlier this morning (you can read it there if you want background), I've dug into it more, and I think there is a bug in =20 cam/scsi/scsi=5Fch=2Ec function chgetelemstatus=2E The short summery is my tape changer says that PVOLTAG in pg=5Fhdr is=20 FALSE, (or zeroed latter) in the first request of=20 scsi=5Fread=5Felement=5Fstatus() (which freeBSD uses only to get the lengt= h of the data) on one of my changers, and thus chio(1) will not show the bar code label=2E pg=5Fhdr is not updated to reflect the location of result of the second call, when this flag is set=2E Worse, it looks like the results of the first call is a dead pointer by the time it checks anyway=2E Unless free/malloc work different in the kernel from userland this is a problem=2E I've sniped out a lot of extra code so you can see what I mean=2E =20 data =3D (caddr=5Ft)malloc(1024, M=5FDEVBUF, M=5FWAITOK); --- Fill data to get size pg=5Fhdr =3D \* data + some offset *\ /* * Reallocate storage for descriptors and get them from the * device=2E */ free(data, M=5FDEVBUF); data =3D (caddr=5Ft)malloc(size, M=5FDEVBUF, M=5FWAITOK); --- Fill data=20 copy=5Felement=5Fstatus(softc, pg=5Fhdr->flags, desc, ces); Note that pg=5Fhdr is not valid at this point anyway=2E This more or less happens in 4=2Ex, 5=2Ex and current if I read the code correctly=2E Can someone who knows kernel code better than I look at this=2E =20 Should I send a pr=3F Here is a patch against 4=2E9 (where I first found this problem) that might help to understand the fix=2E I think it needs to be ported to all versions=2E (and perhaps netbsd if there is where we get the code=3F) =20 *** scsi=5Fch=2Ec=2Eold Tue Mar 22 11:16:15 2005 --- scsi=5Fch=2Ec Tue Mar 22 11:09:13 2005 *************** *** 1184,1189 **** --- 1184,1192 ---- * Fill in the user status array=2E */ st=5Fhdr =3D (struct read=5Felement=5Fstatus=5Fheader *)data; + pg=5Fhdr =3D (struct read=5Felement=5Fstatus=5Fpage=5Fheader *)((uintptr=5Ft)st=5Fhdr + + sizeof(struct read=5Felement=5Fstatus=5Fheader)); + avail =3D scsi=5F2btoul(st=5Fhdr->count); if (avail !=3D cesr->cesr=5Felement=5Fcount) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?380-220053222163355859>