Merge branch 'intx' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6
[pandora-kernel.git] / drivers / pcmcia / pcmcia_ioctl.c
index 9ad18e6..d077870 100644 (file)
@@ -128,9 +128,12 @@ static int proc_read_drivers(char *buf, char **start, off_t pos,
                             int count, int *eof, void *data)
 {
        char *p = buf;
+       int rc;
 
-       bus_for_each_drv(&pcmcia_bus_type, NULL,
-                        (void *) &p, proc_read_drivers_callback);
+       rc = bus_for_each_drv(&pcmcia_bus_type, NULL,
+                             (void *) &p, proc_read_drivers_callback);
+       if (rc < 0)
+               return rc;
 
        return (p - buf);
 }
@@ -269,8 +272,10 @@ rescan:
         * Prevent this racing with a card insertion.
         */
        mutex_lock(&s->skt_mutex);
-       bus_rescan_devices(&pcmcia_bus_type);
+       ret = bus_rescan_devices(&pcmcia_bus_type);
        mutex_unlock(&s->skt_mutex);
+       if (ret)
+               goto err_put_module;
 
        /* check whether the driver indeed matched. I don't care if this
         * is racy or not, because it can only happen on cardmgr access
@@ -589,7 +594,12 @@ static int ds_ioctl(struct inode * inode, struct file * file,
 
     err = ret = 0;
 
-    if (cmd & IOC_IN) __copy_from_user((char *)buf, uarg, size);
+    if (cmd & IOC_IN) {
+       if (__copy_from_user((char *)buf, uarg, size)) {
+           err = -EFAULT;
+           goto free_out;
+       }
+    }
 
     switch (cmd) {
     case DS_ADJUST_RESOURCE_INFO: