don't copy back if an error was returned.
authorAlan Hourihane <alanh@fairlite.demon.co.uk>
Wed, 26 Sep 2007 14:38:54 +0000 (15:38 +0100)
committerAlan Hourihane <alanh@fairlite.demon.co.uk>
Wed, 26 Sep 2007 14:38:54 +0000 (15:38 +0100)
linux-core/drm_drv.c

index cedb6d5013f67c9991958fe82cdfc91e7be26c16..8513a28f6f85877577ceb46789143e087eea769b 100644 (file)
@@ -645,7 +645,7 @@ long drm_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                retcode = func(dev, kdata, file_priv);
        }
 
-       if (cmd & IOC_OUT) {
+       if ((retcode == 0) && cmd & IOC_OUT) {
                if (copy_to_user((void __user *)arg, kdata,
                                 _IOC_SIZE(cmd)) != 0)
                        retcode = -EACCES;