From 01a9b73d338c6ac427e752fbc56c85d1ab5259b9 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sat, 28 Mar 2009 14:35:26 -0400 Subject: tuner: prevent invalid initialization of t->config in set_type From: Michael Krufky Drivers that don't set "config" directly in the set_type function will end up with an invalid configuration value. Check that the value is sane, otherwise initialize to 0. Thanks to James Edward Geiger & Steven Toth for reporting this bug. Priority: high Signed-off-by: Michael Krufky Cc: Steven Toth Cc: James Edward Geiger --- linux/drivers/media/video/tuner-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 0188d87ea..a0cbd71e8 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -365,7 +365,8 @@ static void set_type(struct i2c_client *c, unsigned int type, } t->type = type; - t->config = new_config; + /* prevent invalid config values */ + t->config = ((new_config >= 0) && (new_config < 256)) ? new_config : 0; if (tuner_callback != NULL) { tuner_dbg("defining GPIO callback\n"); t->fe.callback = tuner_callback; -- cgit v1.2.3