Skip to content

Commit a0a0bde

Browse files
tiwaidanvet
authored andcommitted
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: Takashi Iwai <tiwai@suse.de> [danvet: Add note that just dropping the event is ok.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent e2beb6c commit a0a0bde

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/gpu/drm/drm_fops.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ ssize_t drm_read(struct file *filp, char __user *buffer,
527527
if (copy_to_user(buffer + total,
528528
e->event, e->event->length)) {
529529
total = -EFAULT;
530+
e->destroy(e);
530531
break;
531532
}
532533

0 commit comments

Comments
 (0)