HID: fix incorrect free in hiddev

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 19, 2009 - 2:59 pm

Gitweb:     http://git.kernel.org/linus/48e7a3c95c9f98c2cb6f894820e3cc2d0448e92f
Commit:     48e7a3c95c9f98c2cb6f894820e3cc2d0448e92f
Parent:     d2f8d7ee1a9b4650b4e43325b321801264f7c37a
Author:     Johannes Weiner <hannes@cmpxchg.org>
AuthorDate: Tue Mar 10 22:43:56 2009 +0100
Committer:  Jiri Kosina <jkosina@suse.cz>
CommitDate: Tue Mar 10 22:43:56 2009 +0100

    HID: fix incorrect free in hiddev
    
    If hiddev_open() fails, it wrongly frees the shared hiddev structure
    kept in hiddev_table instead of the hiddev_list structure allocated
    for the opened file descriptor.  Existing references to this structure
    will then accessed free memory.
    
    This was introduced by 079034073 "HID: hiddev cleanup -- handle all
    error conditions properly".
    
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Oliver Neukum <oliver@neukum.name>
    Cc: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
 drivers/hid/usbhid/hiddev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 4940e4d..00ea1ed 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -306,7 +306,7 @@ static int hiddev_open(struct inode *inode, struct file *file)
 	return 0;
 bail:
 	file->private_data = NULL;
-	kfree(list->hiddev);
+	kfree(list);
 	return res;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
HID: fix incorrect free in hiddev, Linux Kernel Mailing ..., (Thu Mar 19, 2:59 pm)