Commit 22a6d651 authored by Linus Torvalds's avatar Linus Torvalds

When opening a CD-ROM device with O_NONBLOCK (for setup and ioctl),

we should allow read-write accesses - it's used for control, not
data.
parent bec0e17e
...@@ -443,15 +443,16 @@ int cdrom_open(struct inode *ip, struct file *fp) ...@@ -443,15 +443,16 @@ int cdrom_open(struct inode *ip, struct file *fp)
if ((cdi = cdrom_find_device(dev)) == NULL) if ((cdi = cdrom_find_device(dev)) == NULL)
return -ENODEV; return -ENODEV;
if ((fp->f_mode & FMODE_WRITE) && !CDROM_CAN(CDC_DVD_RAM))
return -EROFS;
/* if this was a O_NONBLOCK open and we should honor the flags, /* if this was a O_NONBLOCK open and we should honor the flags,
* do a quick open without drive/disc integrity checks. */ * do a quick open without drive/disc integrity checks. */
if ((fp->f_flags & O_NONBLOCK) && (cdi->options & CDO_USE_FFLAGS)) if ((fp->f_flags & O_NONBLOCK) && (cdi->options & CDO_USE_FFLAGS))
ret = cdi->ops->open(cdi, 1); ret = cdi->ops->open(cdi, 1);
else else {
if ((fp->f_mode & FMODE_WRITE) && !CDROM_CAN(CDC_DVD_RAM))
return -EROFS;
ret = open_for_data(cdi); ret = open_for_data(cdi);
}
if (!ret) cdi->use_count++; if (!ret) cdi->use_count++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment