OSDN Git Service

security: avoid calling a NULL function pointer in drivers/video/tvaudio.c
authorArjan van de Ven <arjan@linux.intel.com>
Sat, 11 Oct 2008 04:16:12 +0000 (21:16 -0700)
committerWilly Tarreau <w@1wt.eu>
Sun, 19 Oct 2008 21:11:40 +0000 (23:11 +0200)
NULL function pointers are very bad security wise. This one got caught by
kerneloops.org quite a few times, so it's happening in the field....

Fix is simple, check the function pointer for NULL, like 6 other places
in the same function are already doing.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
[2.6 commit: 5ba2f67afb02c5302b2898949ed6fc3b3d37dcf1]
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/media/video/tvaudio.c

index 35e6f7a..d4f1a07 100644 (file)
@@ -1635,7 +1635,7 @@ static int chip_command(struct i2c_client *client,
        case VIDIOCSFREQ:
        {
                chip->mode = 0; /* automatic */
-               if (desc->checkmode) {
+               if (desc->checkmode && desc->setmode) {
                        desc->setmode(chip,VIDEO_SOUND_MONO);
                        if (chip->prevmode != VIDEO_SOUND_MONO)
                                chip->prevmode = -1; /* reset previous mode */