Skip to content

Commit

Permalink
V4L/DVB (11251): tuner: prevent invalid initialization of t->config i…
Browse files Browse the repository at this point in the history
…n set_type

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.

Cc: Steven Toth <stoth@linuxtv.org>
Cc: James Edward Geiger <james.e.geiger@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Michael Krufky authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent 997fb78 commit e7ddcd9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/media/video/tuner-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,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;
Expand Down

0 comments on commit e7ddcd9

Please sign in to comment.