kernel - Disallow dsioctl when no media is present
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 30 Apr 2010 18:06:56 +0000 (11:06 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 30 Apr 2010 18:09:22 +0000 (11:09 -0700)
* Attempt to fix a panic which can occur when attempts are made to
  call ioctl() via a slice/partition on removable drives with no media.

sys/kern/subr_diskslice.c

index 47d9256..931178d 100644 (file)
@@ -389,6 +389,8 @@ dsioctl(cdev_t dev, u_long cmd, caddr_t data, int flags,
        slice = dkslice(dev);
        part = dkpart(dev);
        ssp = *sspp;
+       if (ssp == NULL)
+               return (EINVAL);
        if (slice >= ssp->dss_nslices)
                return (EINVAL);
        sp = &ssp->dss_slices[slice];