Re: Ejecting a mounted CD-ROM works :-(

Nathan Hand (nathanh@wookie.chirp.com.au)
Sat, 20 Feb 1999 18:25:52 +1100 (EST)


On Fri, 19 Feb 1999, Gerd Knorr wrote:

> In lists.linux.kernel you write:
>
> >I did some experiments with cdrecord last few days, for example how to
> >eject a CDROM ...
>
> >ok, letīs do that
> ># cdrecord dev=0,2,0 -eject
>
> >*click**screeek**click*
> >CD is ejected from my cdrom now :-)
>
> >Ok, try to eject a mounted(!!) cd-rom. This should make some headace
> >to the kernel, this is the reason why cdroms (eject-button) are locked
> >while mounted, right?
>
> If you ask the kernel for ejecting the cdrom (CDROMEJECT ioctl), you'll
> get a EBUSY.
>
> cdrecord talks directly to the device (via generic scsi), therefore
> the kernel can't block the eject attempt.

The kernel should disable /dev/sg0 when /dev/scd0 or /dev/sda* is in
use, to avoid far worse problems than ejected disks.

Then again, only root can cause this problem, so perhaps there is no
point in dummifying it. If you're root, your problem.

On reflection, maybe not. You have /dev/scd0 with "ro,user". As root
you're burning a cd. A malicious user mounts it. Boom.

If the kernel is preventing this sort of effect, why doesn't it stop
the eject mounted cd case as well? Seems like the same problem.

On a seperate issue, mounting /dev/scd0 as a user with an audio disc
in the drive causes a repeatable lockup, no oops or stack trace. I'm
looking into this with the technique of recompile, reboot, mount and
crash, then moving the breakpoint back :-/ This is 2.2.0. If a cause
is found (probably user error) I'll submit more information. Maybe a
patch already exists and I just haven't noticed yet?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/