HID: fix incorrent length condition in hidraw_write()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Tuesday, October 14, 2008 - 5:04 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b107d...
Commit:     2b107d629dc0c35de606bb7b010b829cd247a93a
Parent:     d92870ddd248e8c2562a8c4047885d3ad221ece7
Author:     Jiri Kosina <jkosina@suse.cz>
AuthorDate: Wed Sep 17 19:41:58 2008 +0200
Committer:  Jiri Kosina <jkosina@suse.cz>
CommitDate: Tue Oct 14 23:51:00 2008 +0200

    HID: fix incorrent length condition in hidraw_write()
    
    The bound check on the buffer length
    
    	if (count > HID_MIN_BUFFER_SIZE)
    
    is of course incorrent, the proper check is
    
    	if (count > HID_MAX_BUFFER_SIZE)
    
    Fix it.
    
    Reported-by: Jerry Ryle <jerry@mindtribe.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
 drivers/hid/hidraw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 4be240e..497e0d1 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -113,7 +113,7 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
 	if (!dev->hid_output_raw_report)
 		return -ENODEV;
 
-	if (count > HID_MIN_BUFFER_SIZE) {
+	if (count > HID_MAX_BUFFER_SIZE) {
 		printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
 				task_pid_nr(current));
 		return -EINVAL;
--
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 incorrent length condition in hidraw_write(), Linux Kernel Mailing ..., (Tue Oct 14, 5:04 pm)