Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138989
b: refs/heads/master
c: 955a23e
h: refs/heads/master
i:
  138987: b1af516
v: v3
  • Loading branch information
Eric Anholt authored and Dave Airlie committed Mar 29, 2009
1 parent c172dd7 commit 9a7aefc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: af7ae351ad63a137ece86740dbe3f181d09d810f
refs/heads/master: 955a23eb3cfc773e71b05bb7a0a0938a9e1b2568
15 changes: 10 additions & 5 deletions trunk/drivers/gpu/drm/drm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
drm_ioctl_t *func;
unsigned int nr = DRM_IOCTL_NR(cmd);
int retcode = -EINVAL;
char stack_kdata[128];
char *kdata = NULL;

atomic_inc(&dev->ioctl_count);
Expand Down Expand Up @@ -459,10 +460,14 @@ int drm_ioctl(struct inode *inode, struct file *filp,
retcode = -EACCES;
} else {
if (cmd & (IOC_IN | IOC_OUT)) {
kdata = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL);
if (!kdata) {
retcode = -ENOMEM;
goto err_i1;
if (_IOC_SIZE(cmd) <= sizeof(stack_kdata)) {
kdata = stack_kdata;
} else {
kdata = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL);
if (!kdata) {
retcode = -ENOMEM;
goto err_i1;
}
}
}

Expand All @@ -483,7 +488,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
}

err_i1:
if (kdata)
if (kdata != stack_kdata)
kfree(kdata);
atomic_dec(&dev->ioctl_count);
if (retcode)
Expand Down

0 comments on commit 9a7aefc

Please sign in to comment.