Re: vinum crashing with latest current

From: Colin Percival <colin.percival_at_wadham.ox.ac.uk>
Date: Tue, 22 Jun 2004 05:34:02 +0100
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
_at__at_ -68,7 +68,7 _at__at_ 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
_at__at_ -169,7 +169,7 _at__at_ 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
Received on Tue Jun 22 2004 - 02:35:01 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:58 UTC