]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/cdrom/cdrom.c
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[karo-tx-linux.git] / drivers / cdrom / cdrom.c
index 55eaf474d32c3afa18aab0433552edc4dc193f6f..d620b44957454a80fcf444d10cb967e66fb9d7d5 100644 (file)
 
 /* used to tell the module to turn on full debugging messages */
 static bool debug;
-/* used to keep tray locked at all times */
-static int keeplocked;
 /* default compatibility mode */
 static bool autoclose=1;
 static bool autoeject;
@@ -1204,7 +1202,7 @@ void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode)
                cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name);
                cdrom_dvd_rw_close_write(cdi);
 
-               if ((cdo->capability & CDC_LOCK) && !keeplocked) {
+               if ((cdo->capability & CDC_LOCK) && !cdi->keeplocked) {
                        cdinfo(CD_CLOSE, "Unlocking door!\n");
                        cdo->lock_door(cdi, 0);
                }
@@ -1371,7 +1369,7 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)
        curslot = info->hdr.curslot;
        kfree(info);
 
-       if (cdi->use_count > 1 || keeplocked) {
+       if (cdi->use_count > 1 || cdi->keeplocked) {
                if (slot == CDSL_CURRENT) {
                        return curslot;
                } else {
@@ -2119,11 +2117,6 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
        if (!nr)
                return -ENOMEM;
 
-       if (!access_ok(VERIFY_WRITE, ubuf, nframes * CD_FRAMESIZE_RAW)) {
-               ret = -EFAULT;
-               goto out;
-       }
-
        cgc.data_direction = CGC_DATA_READ;
        while (nframes > 0) {
                if (nr > nframes)
@@ -2132,7 +2125,7 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
                ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW);
                if (ret)
                        break;
-               if (__copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) {
+               if (copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) {
                        ret = -EFAULT;
                        break;
                }
@@ -2140,7 +2133,6 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
                nframes -= nr;
                lba += nr;
        }
-out:
        kfree(cgc.buffer);
        return ret;
 }
@@ -2295,7 +2287,7 @@ static int cdrom_ioctl_eject(struct cdrom_device_info *cdi)
 
        if (!CDROM_CAN(CDC_OPEN_TRAY))
                return -ENOSYS;
-       if (cdi->use_count != 1 || keeplocked)
+       if (cdi->use_count != 1 || cdi->keeplocked)
                return -EBUSY;
        if (CDROM_CAN(CDC_LOCK)) {
                int ret = cdi->ops->lock_door(cdi, 0);
@@ -2322,7 +2314,7 @@ static int cdrom_ioctl_eject_sw(struct cdrom_device_info *cdi,
 
        if (!CDROM_CAN(CDC_OPEN_TRAY))
                return -ENOSYS;
-       if (keeplocked)
+       if (cdi->keeplocked)
                return -EBUSY;
 
        cdi->options &= ~(CDO_AUTO_CLOSE | CDO_AUTO_EJECT);
@@ -2453,7 +2445,7 @@ static int cdrom_ioctl_lock_door(struct cdrom_device_info *cdi,
        if (!CDROM_CAN(CDC_LOCK))
                return -EDRIVE_CANT_DO_THIS;
 
-       keeplocked = arg ? 1 : 0;
+       cdi->keeplocked = arg ? 1 : 0;
 
        /*
         * Don't unlock the door on multiple opens by default, but allow