[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-scsi
Subject: Re: Bug in sr.c
From: Jens Axboe <axboe () suse ! de>
Date: 2001-05-23 22:12:32
[Download RAW message or body]
On Wed, May 23 2001, Matthias Jordan wrote:
> Hallo, Jens!
>
> Du stehst in der Maintainer-Liste als Maintainer für die
> SCSI-CD-ROM-Treiber. Ich hatte das Problem, daß bei Kernel
> 2.4.4 und 2.4.5 der Kernel mit der Fehlermeldung "Kernel
> panic: scsi_free:Bad offset" stehen blieb. Nach einer Suche
> per Google habe ich jemanden gefunden, der mir den Tip gab,
> die sr.c aus der 2.4.1 statt der neueren Version dieser
> Datei zu verwenden. Siehe da: das Mounten funktioniert
> problemlos. Sein Hinweis war, daß wir beide wohl nicht die
> einzigen seien, die da Probleme hätten. Wenn ich irgend
> etwas tun kann, um Dir nen Hinweis zu geben, was da genau
> passiert, sag bitte bescheid. Ich fänd´s zu cool, mal wieder
> nen Kerlen out-of-the-box kompilieren zu können.
I don't speak german, but from the english error snippet I'm guessing
this patch will help you.
If not, feel free to mail me in english.
--
Jens Axboe
diff -urN --exclude-from /home/axboe/cdrom/exclude \
/opt/kernel/linux-2.4.4-pre2/drivers/scsi/sr.c \
linux/drivers/scsi/sr.c
--- /opt/kernel/linux-2.4.4-pre2/drivers/scsi/sr.c Mon Feb 19 19:25:17 2001
+++ linux/drivers/scsi/sr.c Mon Apr 9 09:18:46 2001
@@ -262,7 +262,7 @@
static int sr_scatter_pad(Scsi_Cmnd *SCpnt, int s_size)
{
struct scatterlist *sg, *old_sg = NULL;
- int i, fsize, bsize, sg_ent;
+ int i, fsize, bsize, sg_ent, sg_count;
char *front, *back;
back = front = NULL;
@@ -290,17 +290,24 @@
/*
* extend or allocate new scatter-gather table
*/
- if (SCpnt->use_sg)
+ sg_count = SCpnt->use_sg;
+ if (sg_count)
old_sg = (struct scatterlist *) SCpnt->request_buffer;
else {
- SCpnt->use_sg = 1;
+ sg_count = 1;
sg_ent++;
}
- SCpnt->sglist_len = ((sg_ent * sizeof(struct scatterlist)) + 511) & ~511;
- if ((sg = scsi_malloc(SCpnt->sglist_len)) == NULL)
+ i = ((sg_ent * sizeof(struct scatterlist)) + 511) & ~511;
+ if ((sg = scsi_malloc(i)) == NULL)
goto no_mem;
+ /*
+ * no more failing memory allocs possible, we can safely assign
+ * SCpnt values now
+ */
+ SCpnt->sglist_len = i;
+ SCpnt->use_sg = sg_count;
memset(sg, 0, SCpnt->sglist_len);
i = 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic