Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jun 2004 05:34:02 +0100
From:      Colin Percival <colin.percival@wadham.ox.ac.uk>
To:        chancedj@yahoo.com, le@freebsd.org, phk@freebsd.org, grog@freebsd.org
Cc:        current@freebsd.org
Subject:   Re: vinum crashing with latest current
Message-ID:  <6.1.0.6.1.20040622051016.03cae4e8@popserver.sfu.ca>
In-Reply-To: <20040622035316.30729.qmail@web53702.mail.yahoo.com>
References:  <20040622035316.30729.qmail@web53702.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At 04:53 22/06/2004, Daryl Chance wrote:
>[summary: vinum is breaking, with a null pointer dereference]

In sys/dev/vinum/vinumio.c we find (existing in various forms for
the past four years):
    71          drive->lasterror = (dsw->d_open) (drive->dev, FWRITE | FREAD, 0, NULL);

while in src/sys/geom/geom_dev.c we find (added three days ago):
   151  g_dev_open(struct cdev *dev, int flags, int fmt, struct thread *td)
...
   177                error = securelevel_ge(td->td_ucred, 2);

Now, I'm not sure which of these is correct, but ONE of the following
two patches should be applied:
--- src/sys/dev/vinum/vinumio.c	17 Jun 2004 17:16:47 -0000	1.99
+++ src/sys/dev/vinum/vinumio.c	22 Jun 2004 04:29:08 -0000
@@ -68,7 +68,7 @@ open_drive(struct drive *drive, struct t
 	drive->lasterror = ENOTBLK;
     else {
         DROP_GIANT();
-	drive->lasterror = (dsw->d_open) (drive->dev, FWRITE | FREAD, 0, NULL);
+	drive->lasterror = (dsw->d_open) (drive->dev, FWRITE | FREAD, 0, td);
         PICKUP_GIANT();
     }
 

OR

--- src/sys/geom/geom_dev.c	19 Jun 2004 09:00:53 -0000	1.77
+++ src/sys/geom/geom_dev.c	22 Jun 2004 04:26:01 -0000
@@ -169,7 +169,7 @@ g_dev_open(struct cdev *dev, int flags,
 #else
 	e = 0;
 #endif
-	if (w) {
+	if (td != NULL && w) {
 		/*
 		 * When running in very secure mode, do not allow
 		 * opens for writing of any disks.

I'll let the respective maintainers of vinum and geom argue this one
out between them. :-)

Colin Percival



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