Commit a0a0bde3 authored by Takashi Iwai's avatar Takashi Iwai Committed by Daniel Vetter

drm: Fix memory leak at error path of drm_read()

Note that the read manpages explicitly states that the read position
is undefined on error. Since EFAULT is just a userspace bug we are
therefore fine with just dropping the event on the floor.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
[danvet: Add note that just dropping the event is ok.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent e2beb6cd
...@@ -527,6 +527,7 @@ ssize_t drm_read(struct file *filp, char __user *buffer, ...@@ -527,6 +527,7 @@ ssize_t drm_read(struct file *filp, char __user *buffer,
if (copy_to_user(buffer + total, if (copy_to_user(buffer + total,
e->event, e->event->length)) { e->event, e->event->length)) {
total = -EFAULT; total = -EFAULT;
e->destroy(e);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment