From: Pete Zaitcev <zaitcev@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: zaitcev@redhat.com
Subject: Patch for oopses if sd_init fails
Date: Wed, 5 Dec 2001 19:39:41 -0500 [thread overview]
Message-ID: <20011205193941.A23288@devserv.devel.redhat.com> (raw)
This patch does not fix _all_ of oopses, I am working on
a worse one yet in scsi.c. This whole area is a rat hole.
However, I would appreciate if Marcelo
added those now - if nobody disagrees.
Ask me for precise oops scenarios, if anything is unclear.
-- Pete
diff -ur -X dontdiff linux-2.4.17-pre4/drivers/scsi/sd.c linux-2.4.17-pre4-p3/drivers/scsi/sd.c
--- linux-2.4.17-pre4/drivers/scsi/sd.c Fri Nov 9 14:05:06 2001
+++ linux-2.4.17-pre4-p3/drivers/scsi/sd.c Wed Dec 5 15:10:50 2001
@@ -1175,7 +1175,8 @@
kfree(sd_gendisks[i].de_arr);
kfree(sd_gendisks[i].flags);
}
- kfree(sd_gendisks);
+ if (sd_gendisks != &sd_gendisk)
+ kfree(sd_gendisks);
cleanup_sd_gendisks:
kfree(sd);
cleanup_sd:
@@ -1188,6 +1189,7 @@
kfree(sd_sizes);
cleanup_disks:
kfree(rscsi_disks);
+ rscsi_disks = NULL;
cleanup_devfs:
for (i = 0; i < N_USED_SD_MAJORS; i++) {
devfs_unregister_blkdev(SD_MAJOR(i), "sd");
@@ -1251,7 +1253,7 @@
if (SDp->type != TYPE_DISK && SDp->type != TYPE_MOD)
return 0;
- if (sd_template.nr_dev >= sd_template.dev_max) {
+ if (sd_template.nr_dev >= sd_template.dev_max || rscsi_disks == NULL) {
SDp->attached--;
return 1;
}
@@ -1347,6 +1349,9 @@
int i, j;
int max_p;
int start;
+
+ if (rscsi_disks == NULL)
+ return;
for (dpnt = rscsi_disks, i = 0; i < sd_template.dev_max; i++, dpnt++)
if (dpnt->device == SDp) {
diff -ur -X dontdiff linux-2.4.17-pre4/drivers/scsi/sr.c linux-2.4.17-pre4-p3/drivers/scsi/sr.c
--- linux-2.4.17-pre4/drivers/scsi/sr.c Thu Oct 25 13:58:35 2001
+++ linux-2.4.17-pre4-p3/drivers/scsi/sr.c Wed Dec 5 15:32:09 2001
@@ -542,7 +542,7 @@
if (SDp->type != TYPE_ROM && SDp->type != TYPE_WORM)
return 1;
- if (sr_template.nr_dev >= sr_template.dev_max) {
+ if (sr_template.nr_dev >= sr_template.dev_max || scsi_CDs == NULL) {
SDp->attached--;
return 1;
}
@@ -830,6 +830,7 @@
kfree(sr_sizes);
cleanup_cds:
kfree(scsi_CDs);
+ scsi_CDs = NULL;
cleanup_devfs:
devfs_unregister_blkdev(MAJOR_NR, "sr");
sr_registered--;
@@ -904,6 +905,9 @@
{
Scsi_CD *cpnt;
int i;
+
+ if (scsi_CDs == NULL)
+ return;
for (cpnt = scsi_CDs, i = 0; i < sr_template.dev_max; i++, cpnt++)
if (cpnt->device == SDp) {
reply other threads:[~2001-12-06 0:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011205193941.A23288@devserv.devel.redhat.com \
--to=zaitcev@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox