lkml.org 
[lkml]   [2004]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2.4] I2C updates for 2.4.28 (1/5)
Original report and discussion:
http://archives.andrew.net.au/lm-sensors/msg18839.html

Bottom line:
i2c_register_entry shouldn't rely on the procname field to detect the
end of the control table, but on the ctl_name field. The latter is
guaranteed to be non-zero except for the table terminator, the former
can be null even in the middle of the table.

The bug wasn't caught so far because all users of this function
(basically the lm_sensors project's drivers) were exporting all entries
through /proc so procname was never null (except for the table
terminator, obviously).

Credits go to Louis-Martin Cote for discovering the bug and proposing a
fix.

Signed-off-by: Jean Delvare <khali@linux-fr.org>

--- linux-2.4.28-pre3/drivers/i2c/i2c-proc.c.orig 2004-09-29 22:35:29.000000000 +0200
+++ linux-2.4.28-pre3/drivers/i2c/i2c-proc.c 2004-09-29 22:34:59.000000000 +0200
@@ -152,7 +152,7 @@
id += 256;

len = 0;
- while (ctl_template[len].procname)
+ while (ctl_template[len].ctl_name)
len++;
len += 7;
if (!(new_table = kmalloc(sizeof(ctl_table) * len, GFP_KERNEL))) {

--
Jean Delvare
http://khali.linux-fr.org/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.037 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site