Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9d5b3ffc42f7820e8ee07705496955e4c2c38dd9
Commit:     9d5b3ffc42f7820e8ee07705496955e4c2c38dd9
Parent:     19a8f59ab8ceee751ea720085098355d53f727d6
Author:     Dave Airlie <[EMAIL PROTECTED]>
AuthorDate: Thu Feb 7 14:51:32 2008 +1000
Committer:  Dave Airlie <[EMAIL PROTECTED]>
CommitDate: Thu Feb 7 15:12:00 2008 +1000

    drm: fixup some of the ioctl function exit paths
    
    Signed-off-by: Dave Airlie <[EMAIL PROTECTED]>
---
 drivers/char/drm/drm_drv.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index 77e2fb7..0e7af53 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -495,23 +495,25 @@ int drm_ioctl(struct inode *inode, struct file *filp,
        } else {
                if (cmd & (IOC_IN | IOC_OUT)) {
                        kdata = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL);
-                       if (!kdata)
-                               return -ENOMEM;
+                       if (!kdata) {
+                               retcode = -ENOMEM;
+                               goto err_i1;
+                       }
                }
 
                if (cmd & IOC_IN) {
                        if (copy_from_user(kdata, (void __user *)arg,
                                           _IOC_SIZE(cmd)) != 0) {
-                               retcode = -EACCES;
+                               retcode = -EFAULT;
                                goto err_i1;
                        }
                }
                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;
+                               retcode = -EFAULT;
                }
        }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to